install now requires DESTDIR param

This commit is contained in:
matthias@arch 2022-09-26 20:37:45 +02:00
parent 6dbc750a8a
commit 2eb6a2f0b2

View File

@ -38,25 +38,29 @@ $(OBJECT_DIR)/%.o: %.cpp
$(CXX) -c $< -o $@ $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) $(CXX) -c $< -o $@ $(CXXFLAGS) $(LDFLAGS) $(LDLIBS)
$(OBJECT_DIRS): $(OBJECT_DIRS):
mkdir -p $@ @mkdir -p $@
# #
# INSTALLATION # INSTALLATION
# #
install: $(LIB) $(HEADER_INST) install: $(LIB) $(HEADER_INST)
install -D -m 755 $< $(DESTDIR)/usr/lib/$(subst ../,,$<) @{ [ -z "$(DESTDIR)" ] && echo "Please set the DESTDIR variable (probably to /usr or /usr/local)" && exit 1; } || true
install -D -m 755 ../gen_enum_str.py $(DESTDIR)/usr/bin/gz-enum-str install -D -m 755 $< $(DESTDIR)/lib/$(subst ../,,$<)
install -D -m 755 ../gen_enum_str.py $(DESTDIR)/bin/gz-enum-str
uninstall: uninstall:
-rm $(DESTDIR)/usr/lib/$(subst ../,,$(LIB)) { [ -z "$(DESTDIR)" ] && echo "Please set the DESTDIR variable (probably to /usr or /usr/local)" && exit 1; } || true
-rm $(DESTDIR)/usr/bin/gz-enum-str -rm $(DESTDIR)/lib/$(subst ../,,$(LIB))
-rm -r $(DESTDIR)/usr/include/gz-util/ -rm $(DESTDIR)/bin/gz-enum-str
-rm -r $(DESTDIR)/include/gz-util/
-rm -f $(OBJECT_DIR)/*.stamp -rm -f $(OBJECT_DIR)/*.stamp
$(OBJECT_DIR)/%.stamp: %.hpp $(OBJECT_DIR) $(OBJECT_DIR)/%.stamp: %.hpp $(OBJECT_DIR)
install -D -m 644 $< $(DESTDIR)/usr/include/gz-util/$< @{ [ -z "$(DESTDIR)" ] && echo "Please set the DESTDIR variable (probably to /usr or /usr/local)" && exit 1; } || true
touch $@ install -D -m 644 $< $(DESTDIR)/include/gz-util/$<
@touch $@
@chmod 777 $@
# #
# EXTRAS # EXTRAS