Browse Source

Re-work build slightly; only build mconfig from top-level

Also fix issue preventing correct compiler/flags being used for build
tools compilation.
Davin McCall 2 years ago
parent
commit
7e75365c62
4 changed files with 24 additions and 29 deletions
  1. 17 4
      Makefile
  2. 2 12
      build/Makefile
  3. 3 1
      build/tools/Makefile
  4. 2 12
      src/Makefile

+ 17 - 4
Makefile

@@ -1,6 +1,6 @@
 # Makefile for Dinit.
 
-all:
+all: mconfig
 	$(MAKE) -C build all
 	$(MAKE) -C src all
 	$(MAKE) -C doc/manpages all
@@ -9,16 +9,16 @@ all:
 	@echo "*** integration tests, or \"make install\" to install."
 	@echo "***"
 
-check:
+check: mconfig
 	$(MAKE) -C src check
 
-check-igr:
+check-igr: mconfig
 	$(MAKE) -C src check-igr
 
 run-cppcheck:
 	$(MAKE) -C src run-cppcheck
 
-install:
+install: mconfig
 	$(MAKE) -C src install
 	$(MAKE) -C doc/manpages install
 
@@ -26,3 +26,16 @@ clean:
 	$(MAKE) -C src clean
 	$(MAKE) -C build clean
 	$(MAKE) -C doc/manpages clean
+
+mconfig:
+	@UNAME=`uname`;\
+	if [ -f "./configs/mconfig.$$UNAME.sh" ]; then \
+	    echo "*** Found auto-configuration script for OS: $$UNAME"; \
+	    ( cd ./configs; sh "mconfig.$$UNAME.sh" ) \
+	elif [ -f "./configs/mconfig.$$UNAME" ]; then \
+	    echo "*** Found configuration for OS: $$UNAME"; \
+	    ln -sf "configs/mconfig.$$UNAME" mconfig; \
+	else \
+	    echo "*** No config available. Please create suitable mconfig file."; \
+	    exit 1; \
+	fi

+ 2 - 12
build/Makefile

@@ -3,19 +3,9 @@
 
 all: ../mconfig includes/mconfig.h
 
-# Look for a suitable build config file and use it.
 ../mconfig:
-	@UNAME=`uname`;\
-	if [ -f "../configs/mconfig.$$UNAME.sh" ]; then \
-	    echo "Found auto-configuration script for OS: $$UNAME"; \
-	    ( cd ../configs; sh "mconfig.$$UNAME.sh" ) \
-	elif [ -f "../configs/mconfig.$$UNAME" ]; then \
-	    echo "Found configuration for OS: $$UNAME"; \
-	    ln -sf "configs/mconfig.$$UNAME" ../mconfig; \
-	else \
-	    echo "No config available. Please create suitable mconfig file."; \
-	    exit 1; \
-	fi
+	@echo "*** No mconfig, please run make from top level"
+	@false
 
 includes/mconfig.h: ../mconfig tools/mconfig-gen.cc
 	$(MAKE) -C tools mconfig-gen

+ 3 - 1
build/tools/Makefile

@@ -1,5 +1,7 @@
+-include ../../mconfig
+
 HOSTCXX ?= $(CXX)
-HOSTCXXFLAGS ?= $(CXXFLAGS)
+HOSTCXXOPTS ?= $(CXXOPTS)
 HOSTLDFLAGS ?= $(LDFLAGS)
 
 mconfig-gen: mconfig-gen.cc

+ 2 - 12
src/Makefile

@@ -14,19 +14,9 @@ objects = $(dinit_objects) dinitctl.o dinitcheck.o shutdown.o
 
 all: dinit dinitctl dinitcheck $(SHUTDOWN)
 
-# Look for a suitable build config file and use it.
 ../mconfig:
-	@UNAME=`uname`;\
-	if [ -f "../configs/mconfig.$$UNAME.sh" ]; then \
-	    echo "*** Found auto-configuration script for OS: $$UNAME"; \
-	    ( cd ../configs; sh "mconfig.$$UNAME.sh" ) \
-	elif [ -f "../configs/mconfig.$$UNAME" ]; then \
-	    echo "*** Found configuration for OS: $$UNAME"; \
-	    ln -sf "configs/mconfig.$$UNAME" ../mconfig; \
-	else \
-	    echo "*** No config available. Please create suitable mconfig file."; \
-	    exit 1; \
-	fi
+	@echo "*** No mconfig, please run make from top level"
+	@false
 
 $(objects): ../build/includes/mconfig.h