Browse Source

Re-vamp the "build system".

Move compiler options etc into make variables in the "mconfig" file.
The main makefile includes the mconfig file, so it shouldn't generally
be necessary to edit the makefile itself. Includes sample config for
GCC and LLVM+libc+++.
Davin McCall 8 years ago
parent
commit
a75be7d3a8
2 changed files with 17 additions and 15 deletions
  1. 7 15
      Makefile
  2. 10 0
      mconfig

+ 7 - 15
Makefile

@@ -7,25 +7,17 @@ dinit_objects = dinit.o load_service.o service.o
 all: dinit dinit-start
 
 dinit: $(dinit_objects)
-	g++ -Wall -o dinit $(dinit_objects) -lev
+	$(CXX) -o dinit $(dinit_objects) -lev $(EXTRA_LIBS)
 
 dinit-start: dinit-start.o
-	g++ -Wall -o dinit-start dinit-start.o
+	$(CXX) -o dinit-start dinit-start.o $(EXTRA_LIBS)
 
-# Note we use the old ABI on GCC 5.2 to avoid GCC bug 66145.
 $(objects): %.o: %.cc service.h
-	g++ -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++11 -c -Os -Wall $< -o $@
-
-install: all
-	#install -d $(LOGINBINDIR) $(LOGINDOCDIR)
-	#install -s login $(LOGINBINDIR)
-	#install --mode=644 README $(LOGINDOCDIR)
-	#@echo
-	#@echo "You may also wish to \"make install.man\"."
-
-install.man:
-	#install -d $(MAN1DIR)
-	#install --mode=644 login.1 $(MAN1DIR)
+	$(CXX) -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++11 -c -Os -Wall $< -o $@
+
+#install: all
+
+#install.man:
 
 clean:
 	rm *.o

+ 10 - 0
mconfig

@@ -0,0 +1,10 @@
+# LLVM/clang++ with libc++ on Linux
+#CXX=clang++
+#CXXOPTS=-stdlib=libc++
+#EXTRA_LIBS=-lc++abi
+
+# GCC. Note with GCC 5,5.1,5.2 the new C++11 ABI is buggy.
+CXX=g++
+CXXOPTS=-D_GLIBCXX_USE_CXX11_ABI=0
+EXTRA_LIBS=
+