Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefile improvements #60

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lukeyeager
Copy link
Member

NOTE: this makes two breaking changes to the 'install' target:

  1. Files are now installed to "standard" locations such as /usr/local/bin/ instead of /usr/bin/. To get back to the old behavior:
    sudo make prefix=/usr sysconfdir=/etc install.
  2. The install target no longer depends on the binary target, which could break build workflows which only run make install. This could be fixed with additional work.

Makefile Outdated Show resolved Hide resolved
MKDIR ?= mkdir
prefix ?= /usr/local
bindir ?= $(prefix)/bin
sysconfdir ?= $(prefix)/etc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this standard? I do not see it in the FHS list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I just copied it from Jon who usually tracks these conventions closely: https://github.com/NVIDIA/enroot/blob/v3.4.0/Makefile#L5

But yes, in this case it does look like it's standard:

‘sysconfdir’
The directory for installing read-only data files that pertain to a single machine–that is to say, files for configuring a host. ...
https://www.gnu.org/software/make/manual/html_node/Directory-Variables.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose since we're looking at that file I should point out that files like this should really be under /usr/share/ rather than /etc/ (see the definition of 'datarootdir'), but I don't personally care to make that breaking change today.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with that breaking change is that there are many customers who mount default-counters.csv into /etc/dcgm-exporter/ location via docker -v command-line argument. Such change will break their use cases as they will have to either change where the file is mounted inside the container or change the dcgm-exporter command-line arguments. I would consider both scenarios as a breaking change that needs a major version release at least.

Copy link
Member Author

@lukeyeager lukeyeager Apr 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, yes, I agree. But we're choosing not to make the breaking change, right? I was just making a pedantic point. I'm not arguing that we make that change now or even ever.

e.g. package maintainers may choose to use this to build position
indepent code with `make GOFLAGS=-buildmode=pie binary`
There are no dependencies on the 'binary' target, so it will always
recompile. The README suggests running 'make' and then 'sudo make
install', but since the install target depends on the binary target,
this causes the build to be redone as root, which is both a waste of
compute time and a nuisance since it pollutes the source tree with files
owned by root.

A better fix for this would be to fill in the appropriate dependencies
for the binary target. This change is the quick easy fix.
@nvvfedorov nvvfedorov added duplicate This issue or pull request already exists stale labels Mar 15, 2024
@nvvfedorov
Copy link
Collaborator

The PR is stale because there hasn't been any activity for the last two years.

@nvvfedorov nvvfedorov closed this Mar 15, 2024
@nvvfedorov nvvfedorov reopened this Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants