From 2eb6a2f0b2cbb3e6301555a329aa6db28d483a97 Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Mon, 26 Sep 2022 20:37:45 +0200 Subject: [PATCH] install now requires DESTDIR param --- src/Makefile | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Makefile b/src/Makefile index 8f1b555..7fa3391 100755 --- a/src/Makefile +++ b/src/Makefile @@ -38,25 +38,29 @@ $(OBJECT_DIR)/%.o: %.cpp $(CXX) -c $< -o $@ $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) $(OBJECT_DIRS): - mkdir -p $@ + @mkdir -p $@ # # INSTALLATION # install: $(LIB) $(HEADER_INST) - install -D -m 755 $< $(DESTDIR)/usr/lib/$(subst ../,,$<) - install -D -m 755 ../gen_enum_str.py $(DESTDIR)/usr/bin/gz-enum-str + @{ [ -z "$(DESTDIR)" ] && echo "Please set the DESTDIR variable (probably to /usr or /usr/local)" && exit 1; } || true + install -D -m 755 $< $(DESTDIR)/lib/$(subst ../,,$<) + install -D -m 755 ../gen_enum_str.py $(DESTDIR)/bin/gz-enum-str uninstall: - -rm $(DESTDIR)/usr/lib/$(subst ../,,$(LIB)) - -rm $(DESTDIR)/usr/bin/gz-enum-str - -rm -r $(DESTDIR)/usr/include/gz-util/ + { [ -z "$(DESTDIR)" ] && echo "Please set the DESTDIR variable (probably to /usr or /usr/local)" && exit 1; } || true + -rm $(DESTDIR)/lib/$(subst ../,,$(LIB)) + -rm $(DESTDIR)/bin/gz-enum-str + -rm -r $(DESTDIR)/include/gz-util/ -rm -f $(OBJECT_DIR)/*.stamp $(OBJECT_DIR)/%.stamp: %.hpp $(OBJECT_DIR) - install -D -m 644 $< $(DESTDIR)/usr/include/gz-util/$< - touch $@ + @{ [ -z "$(DESTDIR)" ] && echo "Please set the DESTDIR variable (probably to /usr or /usr/local)" && exit 1; } || true + install -D -m 644 $< $(DESTDIR)/include/gz-util/$< + @touch $@ + @chmod 777 $@ # # EXTRAS