Added configurable `INCLUDE_PREFIX` for install targets.

Fortune for memfd_secret-shim's current commit: Future curse − 末凶
master
Avril 7 months ago
parent 7d182704b9
commit 8c94ce5f70
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -26,6 +26,8 @@ ifeq ($(PREFIX),)
PREFIX := /usr/local PREFIX := /usr/local
endif endif
INCLUDE_PREFIX := $(PROJECT)/
# Default archivers # Default archivers
AR?=ar AR?=ar
RANLIB?=ranlib RANLIB?=ranlib
@ -343,12 +345,13 @@ install:
install -s -m 755 lib$(PROJECT).so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/ install -s -m 755 lib$(PROJECT).so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/
ln -sf lib$(PROJECT).so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/lib$(PROJECT).so.$(VERSION_MAJOR) ln -sf lib$(PROJECT).so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/lib$(PROJECT).so.$(VERSION_MAJOR)
ln -sf lib$(PROJECT).so.$(VERSION_MAJOR) $(DESTDIR)$(PREFIX)/lib/lib$(PROJECT).so ln -sf lib$(PROJECT).so.$(VERSION_MAJOR) $(DESTDIR)$(PREFIX)/lib/lib$(PROJECT).so
install -d $(DESTDIR)$(PREFIX)/include/$(PROJECT)/ install -d $(DESTDIR)$(PREFIX)/include/$(INCLUDE_PREFIX)
install -m 644 $(wildcard $(INCLUDE)/*.*) $(DESTDIR)$(PREFIX)/include/$(PROJECT)/ install -m 644 $(wildcard $(INCLUDE)/*.*) $(DESTDIR)$(PREFIX)/include/$(INCLUDE_PREFIX)
uninstall: uninstall:
-rm $(DESTDIR)$(PREFIX)/lib/lib$(PROJECT).{a,so{,.*}} -rm $(DESTDIR)$(PREFIX)/lib/lib$(PROJECT).{a,so{,.*}}
cd $(INCLUDE) && find . -type f | xargs -I {} rm "$(DESTDIR)$(PREFIX)/include/$(PROJECT)/{}" cd $(INCLUDE) && find . -type f | xargs -I {} rm "$(DESTDIR)$(PREFIX)/include/$(INCLUDE_PREFIX){}"
rmdir $(DESTDIR)$(PREFIX)/include/$(PROJECT) [[ -d "$(DESTDIR)$(PREFIX)/include/$(INCLUDE_PREFIX)" ]] && \
rmdir $(DESTDIR)$(PREFIX)/include/$(INCLUDE_PREFIX) || :
#TODO: We can make the target between `{debug,release}{.a,.so}` configurable by call. e.g. `TARGET=release.a make test` #TODO: We can make the target between `{debug,release}{.a,.so}` configurable by call. e.g. `TARGET=release.a make test`
$(PROJECT)-test: LDFLAGS+= -lfmt -lstdc++ $(PROJECT)-test: LDFLAGS+= -lfmt -lstdc++

Loading…
Cancel
Save