From a75be7d3a81b8e1d312a2e7317f9802b6235e030 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Mon, 14 Sep 2015 21:56:16 +0100 Subject: [PATCH] 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+++. --- Makefile | 22 +++++++--------------- mconfig | 10 ++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 mconfig diff --git a/Makefile b/Makefile index d77bbfb..8982931 100644 --- 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 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= + -- 2.25.1