fix destdir support

Signed-off-by: Miezhiko <Miezhiko@gmail.com>
This commit is contained in:
Miezhiko 2024-08-08 14:06:26 +04:00
parent 22573b7d12
commit 13bafac036
2 changed files with 10 additions and 13 deletions

View File

@ -3,12 +3,12 @@ KMAKE_TARGETS := kmake kload kunload kreload xmod xtclean
.PHONY: $(USPACE_TARGETS) $(KMAKE_TARGETS) clean .PHONY: $(USPACE_TARGETS) $(KMAKE_TARGETS) clean
$(USPACE_TARGETS): $(USPACE_TARGETS):
@$(MAKE) -f uspace.mk $@ @$(MAKE) -ef uspace.mk $@
$(KMAKE_TARGETS): $(KMAKE_TARGETS):
@$(MAKE) -f kmake.mk $@ @$(MAKE) -ef kmake.mk $@
clean: clean:
-@$(MAKE) -f kmake.mk kclean -@$(MAKE) -ef kmake.mk kclean
@$(MAKE) -f uspace.mk clean @$(MAKE) -ef uspace.mk clean

View File

@ -16,8 +16,6 @@ LIBMNL_LIBS := -L$(DEPSDIR)/lib
# PREFIX is environment variable, if not set default to /usr/local # PREFIX is environment variable, if not set default to /usr/local
ifeq ($(PREFIX),) ifeq ($(PREFIX),)
PREFIX := /usr/local PREFIX := /usr/local
else
PREFIX := $(DESTDIR)
endif endif
export CC CCLD LD CFLAGS LDFLAGS LIBNFNETLINK_CFLAGS LIBNFNETLINK_LIBS LIBMNL_CFLAGS LIBMNL_LIBS export CC CCLD LD CFLAGS LDFLAGS LIBNFNETLINK_CFLAGS LIBNFNETLINK_LIBS LIBMNL_CFLAGS LIBMNL_LIBS
@ -73,16 +71,16 @@ $(BUILD_DIR)/%.o: %.c $(LIBNETFILTER_QUEUE) $(LIBMNL) config.h
$(CC) -c $(CFLAGS) $(LDFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $(LDFLAGS) $< -o $@
install: all install: all
install -d $(PREFIX)/bin/ install -d $(DESTDIR)$(PREFIX)/bin/
install -m 755 $(APP) $(PREFIX)/bin/ install -m 755 $(APP) $(DESTDIR)$(PREFIX)/bin/
install -d $(PREFIX)/lib/systemd/system/ install -d $(DESTDIR)$(PREFIX)/lib/systemd/system/
@cp youtubeUnblock.service $(BUILD_DIR) @cp youtubeUnblock.service $(BUILD_DIR)
@sed -i 's/$$(PREFIX)/$(subst /,\/,$(PREFIX))/g' $(BUILD_DIR)/youtubeUnblock.service @sed -i 's/$$(PREFIX)/$(subst /,\/,$(PREFIX))/g' $(BUILD_DIR)/youtubeUnblock.service
install -m 644 $(BUILD_DIR)/youtubeUnblock.service $(PREFIX)/lib/systemd/system/ install -m 644 $(BUILD_DIR)/youtubeUnblock.service $(DESTDIR)$(PREFIX)/lib/systemd/system/
uninstall: uninstall:
rm $(PREFIX)/bin/youtubeUnblock rm $(DESTDIR)$(PREFIX)/bin/youtubeUnblock
rm $(PREFIX)/lib/systemd/system/youtubeUnblock.service rm $(DESTDIR)$(PREFIX)/lib/systemd/system/youtubeUnblock.service
-systemctl disable youtubeUnblock.service -systemctl disable youtubeUnblock.service
clean: clean:
@ -91,4 +89,3 @@ clean:
$(MAKE) distclean -C deps/libmnl || true $(MAKE) distclean -C deps/libmnl || true
$(MAKE) distclean -C deps/libnfnetlink || true $(MAKE) distclean -C deps/libnfnetlink || true