diff mk/objective.mk @ 1322:dfa4ef2e8c79 trunk

[svn] - avoid system /bin/test in Makefiles as it may not behave as expected
author nenolod
date Thu, 22 Jun 2006 02:35:01 -0700
parents aa693b651fee
children 43547cd5e74e
line wrap: on
line diff
--- a/mk/objective.mk	Wed Jun 21 02:23:25 2006 -0700
+++ b/mk/objective.mk	Thu Jun 22 02:35:01 2006 -0700
@@ -25,47 +25,47 @@
 install: build
 	$(MAKE) install-prehook
 	@for i in $(BINDIR) $(LIBDIR) $(INCLUDEDIR); do \
-		if test ! -d $(DESTDIR)/$$i; then \
+		if [ ! -d $(DESTDIR)/$$i ]; then \
 			$(INSTALL) -d -m 755 $(DESTDIR)/$$i; \
 		fi; \
 	done;
-	@if test "x$(SUBDIRS)" != "x"; then \
+	@if [ "x$(SUBDIRS)" != "x" ]; then \
 		for i in $(SUBDIRS); do \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[installing subobjective: $$i]"; \
 			fi; \
 			(cd $$i; $(MAKE) install || exit; cd ..); \
 		done; \
 	fi
-	@if test "x$(OBJECTIVE_DIRECTORIES)" != "x"; then \
+	@if [ "x$(OBJECTIVE_DIRECTORIES)" != "x" ]; then \
 		for i in $(OBJECTIVE_DIRECTORIES); do \
 			printf "%10s     %-20s\n" MKDIR $$i; \
 			$(INSTALL) -d -m 755 $(DESTDIR)/$$i; \
 		done; \
 	fi
-	@if test "x$(HEADERS)" != "x"; then \
+	@if [ "x$(HEADERS)" != "x" ]; then \
 		for i in $(HEADERS); do \
 			printf "%10s     %-20s\n" INSTALL $$i; \
 			$(INSTALL_DATA) $(INSTALL_OVERRIDE) $$i $(DESTDIR)/$(INCLUDEDIR)/$$i; \
 		done; \
 	fi
-	@if test "x$(OBJECTIVE_LIBS)" != "x"; then \
+	@if [ "x$(OBJECTIVE_LIBS)" != "x" ]; then \
 		for i in $(OBJECTIVE_LIBS); do \
 			printf "%10s     %-20s\n" INSTALL $$i; \
 			$(INSTALL) $(INSTALL_OVERRIDE) $$i $(DESTDIR)/$(LIBDIR)/$$i; \
 		done; \
 	fi
-	@if test "x$(OBJECTIVE_BINS)" != "x"; then \
+	@if [ "x$(OBJECTIVE_BINS)" != "x" ]; then \
 		for i in $(OBJECTIVE_BINS); do \
 			printf "%10s     %-20s\n" INSTALL $$i; \
 			$(INSTALL) $(INSTALL_OVERRIDE) $$i $(DESTDIR)/$(BINDIR)/$$i; \
 		done; \
 	fi;
-	@if test "x$(OBJECTIVE_DATA)" != "x"; then \
+	@if [ "x$(OBJECTIVE_DATA)" != "x" ]; then \
 		for i in $(OBJECTIVE_DATA); do \
 			source=`echo $$i | cut -d ":" -f1`; \
 			destination=`echo $$i | cut -d ":" -f2`; \
-			if test ! -d $(DESTDIR)/$$destination; then \
+			if [ ! -d $(DESTDIR)/$$destination ]; then \
 				$(INSTALL) -d -m 755 $(DESTDIR)/$$destination; \
 			fi; \
 			printf "%10s     %-20s\n" INSTALL $$source; \
@@ -73,15 +73,15 @@
 		done; \
 	fi
 	$(MAKE) install-posthook
-	@if test $(VERBOSITY) -gt 0; then \
+	@if [ $(VERBOSITY) -gt 0 ]; then \
 		echo "[all objectives installed]"; \
 	fi
 
 clean:
 	$(MAKE) clean-prehook
-	@if test "x$(SUBDIRS)" != "x"; then \
+	@if [ "x$(SUBDIRS)" != "x" ]; then \
 		for i in $(SUBDIRS); do \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[cleaning subobjective: $$i]"; \
 			fi; \
 			(cd $$i; $(MAKE) clean || exit; cd ..); \
@@ -89,99 +89,99 @@
 	fi
 	$(MAKE) clean-posthook
 	rm -f *.o *.lo *.so *.a *.sl
-	@if test "x$(OBJECTIVE_BINS)" != "x"; then \
+	@if [ "x$(OBJECTIVE_BINS)" != "x" ]; then \
 		for i in $(OBJECTIVE_BINS); do \
 			rm -f $$i; \
 		done; \
 	fi
-	@if test "x$(OBJECTIVE_LIBS)" != "x"; then \
+	@if [ "x$(OBJECTIVE_LIBS)" != "x" ]; then \
 		for i in $(OBJECTIVE_LIBS); do \
 			rm -f $$i; \
 		done; \
 	fi
-	@if test "x$(OBJECTIVE_LIBS_NOINST)" != "x"; then \
+	@if [ "x$(OBJECTIVE_LIBS_NOINST)" != "x" ]; then \
 		for i in $(OBJECTIVE_LIBS_NOINST); do \
 			rm -f $$i; \
 		done; \
 	fi
-	@if test $(VERBOSITY) -gt 0; then \
+	@if [ $(VERBOSITY) -gt 0 ]; then \
 		echo "[all objectives cleaned]"; \
 	fi
 
 distclean: clean
-	@if test "x$(SUBDIRS)" != "x"; then \
+	@if [ "x$(SUBDIRS)" != "x" ]; then \
 		for i in $(SUBDIRS); do \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[distcleaning subobjective: $$i]"; \
 			fi; \
 			(cd $$i; $(MAKE) distclean || exit; cd ..); \
 		done; \
 	fi
-	@if test -f Makefile.in; then \
-		rm -f -f Makefile; \
+	@if [ -f Makefile.in ]; then \
+		rm -f Makefile; \
 	fi
-	@if test -f mk/rules.mk; then \
-		rm -f -f mk/rules.mk; \
+	@if [ -f mk/rules.mk ]; then \
+		rm -f mk/rules.mk; \
 	fi
 
 build:
 	# test for GNU make
-	@if test "x$(MAKE_VERSION)" == "x"; then \
+	@if [ "x$(MAKE_VERSION)" == "x" ]; then \
 		echo "[Your make is not properly supported, please use GNU make.]"; \
 		exit 1; \
 	fi;
 	$(MAKE) build-prehook
-	@if test "x$(SUBDIRS)" != "x"; then \
+	@if [ "x$(SUBDIRS)" != "x" ]; then \
 		for i in $(SUBDIRS); do \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[building subobjective: $$i]"; \
 			fi; \
 			cd $$i; $(MAKE) || exit; cd ..; \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[finished subobjective: $$i]"; \
 			fi; \
 		done; \
 	fi
-	@if test "x$(OBJECTIVE_LIBS)" != "x"; then \
+	@if [ "x$(OBJECTIVE_LIBS)" != "x" ]; then \
 		for i in $(OBJECTIVE_LIBS); do \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[building library objective: $$i]"; \
 			fi; \
 			$(MAKE) $$i || exit; \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[finished library objective: $$i]"; \
 			fi; \
 		done; \
 	fi
-	@if test "x$(OBJECTIVE_LIBS_NOINST)" != "x"; then \
+	@if [ "x$(OBJECTIVE_LIBS_NOINST)" != "x" ]; then \
 		for i in $(OBJECTIVE_LIBS_NOINST); do \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[building library dependency: $$i]"; \
 			fi; \
 			$(MAKE) $$i || exit; \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[finished library dependency: $$i]"; \
 			fi; \
 		done; \
 	fi
 	@if test "x$(OBJECTIVE_BINS)" != "x"; then \
 		for i in $(OBJECTIVE_BINS); do \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[building binary objective: $$i]"; \
 			fi; \
 			$(MAKE) $$i || exit; \
-			if test $(VERBOSITY) -gt 0; then \
+			if [ $(VERBOSITY) -gt 0 ]; then \
 				echo "[finished binary objective: $$i]"; \
 			fi; \
 		done; \
 	fi
 	$(MAKE) build-posthook
-	@if test $(VERBOSITY) -gt 0; then \
+	@if [ $(VERBOSITY) -gt 0 ]; then \
 		echo "[all objectives built]"; \
 	fi
 
 .c.o:
-	if test $(SHOW_CFLAGS) -eq 1; then	\
+	@if [ $(SHOW_CFLAGS) -eq 1 ]; then	\
 		printf "%10s     %-20s (%s)\n" CC $< "${CFLAGS}";	\
 	else \
 		printf "%10s     %-20s\n" CC $<;	\
@@ -189,7 +189,7 @@
 	$(CC) $(CFLAGS) -c $< -o $@
 
 .cc.o .cpp.o .cxx.o:
-	if test $(SHOW_CFLAGS) -eq 1; then	\
+	@if [ $(SHOW_CFLAGS) -eq 1 ]; then	\
 		printf "%10s     %-20s (%s)\n" CXX $< "${CXXFLAGS}";	\
 	else \
 		printf "%10s     %-20s\n" CXX $<;	\
@@ -197,10 +197,10 @@
 	$(CXX) $(CXXFLAGS) -c $< -o $@
 
 %.so $(OBJECTIVE_LIBS): $(OBJECTS)
-	if test "x$(OBJECTS)" != "x"; then \
+	if [ "x$(OBJECTS)" != "x" ]; then \
 		$(MAKE) $(OBJECTS) || exit;		\
 		printf "%10s     %-20s\n" LINK $@; \
-		(if test "x$(OBJECTIVE_SONAME_SUFFIX)" != "x"; then \
+		(if [ "x$(OBJECTIVE_SONAME_SUFFIX)" != "x" ]; then \
 			$(CC) -fPIC -DPIC -shared -o $@ -Wl,-soname=$@.$(OBJECTIVE_SONAME_SUFFIX) $(OBJECTS) $(LDFLAGS) $(LIBADD); \
 		else \
 			$(CC) -fPIC -DPIC -shared -o $@ -Wl,-soname=$@ $(OBJECTS) $(LDFLAGS) $(LIBADD); \
@@ -208,14 +208,14 @@
 	fi
 
 %.a: $(OBJECTS)
-	if test "x$(OBJECTS)" != "x"; then \
+	if [ "x$(OBJECTS)" != "x" ]; then \
 		$(MAKE) $(OBJECTS) || exit;		\
 		printf "%10s     %-20s\n" LINK $@; \
 		$(AR) cq $@ $(OBJECTS); \
 	fi
 
 $(OBJECTIVE_BINS): $(OBJECTS)
-	if test "x$(OBJECTS)" != "x"; then \
+	if [ "x$(OBJECTS)" != "x" ]; then \
 		$(MAKE) $(OBJECTS) || exit;		\
 		printf "%10s     %-20s\n" LINK $@; \
 		$(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(LIBADD); \