Re-vamp the "build system".
authorDavin McCall <davmac@davmac.org>
Mon, 14 Sep 2015 20:56:16 +0000 (21:56 +0100)
committerDavin McCall <davmac@davmac.org>
Mon, 14 Sep 2015 20:56:16 +0000 (21:56 +0100)
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+++.

Makefile
mconfig [new file with mode: 0644]

index d77bbfb43c4830a6956fb85ab760666942b6db3f..898293112091bfced4191216f5e903d95f9d31ce 100644 (file)
--- a/Makefile
+++ b/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
diff --git a/mconfig b/mconfig
new file mode 100644 (file)
index 0000000..038e11d
--- /dev/null
+++ b/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=
+