-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add Makefile #5
base: master
Are you sure you want to change the base?
Add Makefile #5
Conversation
…ling directly (do the later on your own risk!)
It would probably better if this was in illumos make and not GNU make, given its target audience. |
I agree. But do you have a guide how to write those statements illumos make conform? I never found any. |
So I think this slightly different INSTALL = /usr/sbin/install
BINDIR = /usr/lib
MANIFESTDIR = /lib/svc/manifest/system
PRE_HASH = pre\#
HASH = $(PRE_HASH:pre\%=%)
SET_OWNER = $(HASH)
$(SET_OWNER)OWNER_BIN = -u root -g bin
$(SET_OWNER)OWNER_SMF = -u root -g sys
INSTALL_BIN = $(INSTALL) -s -f $(DESTDIR)$(BINDIR) $(OWNER_BIN) -m 0755
INSTALL_SMF = $(INSTALL) -s -f $(DESTDIR)$(MANIFESTDIR) $(OWNER_SMF) -m 0644
build: build-debug
build-debug:
cargo build
build-release:
cargo build --release
install-%: build-%
mkdir -p $(DESTDIR)/usr/lib
mkdir -p $(DESTDIR)/lib/svc/manifest/system
$(INSTALL_BIN) target/$(@:install-%=%)/metadata
$(INSTALL_BIN) userscript.sh
$(INSTALL_SMF) metadata.xml
$(INSTALL_SMF) userscript.xml
install: install-release
clean:
cargo clean You would use it thus:
|
Oh, nice. I like it. This is some awesome make foo. I think I understand most. But what does the PRE_HASH/HASH bit do? |
It is the only way of which I am aware to get a macro that contains just the
Will expand to:
Which means it is effectively commented out, and does nothing, leaving
Which will set |
@jclulow Updated as suggested. also fixed the bug where SET_OWNER was not overridable as variable |
Add a Makefile to help with packaging and building consistently