فهرست منبع

Makefile: Do not depend on the "all" target for "install".

Instead, check if the binary was built beforehand with an if clause.
This helps avoid rebuilding the project as root by accident.
parazyd 4 سال پیش
والد
کامیت
7056442a6b
1فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 10 1
      Makefile

+ 10 - 1
Makefile

@@ -59,7 +59,16 @@ test-tx:
 clean:
 clean:
 	rm -f $(BINS)
 	rm -f $(BINS)
 
 
-install: all
+install:
+	@for i in $(BINS); \
+	do \
+		if test ! -f $$i; \
+		then \
+			echo "The '$$i' binary was not built."; \
+			echo "You should run 'make BINS=$$i' as a normal user before installing."; \
+			exit 1; \
+		fi; \
+	done;
 	mkdir -p $(DESTDIR)$(PREFIX)/bin
 	mkdir -p $(DESTDIR)$(PREFIX)/bin
 	cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin
 	cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin