diff options
author | Attila Molnar <attilamolnar@hush.com> | 2013-07-04 10:17:48 -0700 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2013-07-04 10:17:48 -0700 |
commit | 27ae66eb3fb7056570936e7f4655ec3128bac2a7 (patch) | |
tree | 87621d8cecc160fa7b2089f7b32a6c6b61cea324 | |
parent | fd0fa86da89ab4cefa778307088ef2552a05a170 (diff) | |
parent | 240f34086a805dc4c3151aae00101f9bec6870df (diff) |
Merge pull request #577 from SaberUK/master+makefile-cleanup
Tidy up the Makefile template.
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | make/template/main.mk | 54 | ||||
-rwxr-xr-x | make/unit-cc.pl | 2 |
3 files changed, 26 insertions, 32 deletions
@@ -960,6 +960,7 @@ EOF s/\@IFDEF (\S+)/ifdef $1/g; s/\@IFNDEF (\S+)/ifndef $1/g; s/\@IFEQ (\S+) (\S+)/ifeq ($1,$2)/g; + s/\@IFNEQ (\S+) (\S+)/ifneq ($1,$2)/g; s/\@ELSIFEQ (\S+) (\S+)/else ifeq ($1,$2)/g; s/\@ELSE/else/g; s/\@ENDIF/endif/g; @@ -975,6 +976,7 @@ EOF s/\@IFDEF (\S+)/.if defined($1)/g; s/\@IFNDEF (\S+)/.if !defined($1)/g; s/\@IFEQ (\S+) (\S+)/.if $1 == $2/g; + s/\@IFNEQ (\S+) (\S+)/.if $1 != $2/g; s/\@ELSIFEQ (\S+) (\S+)/.elif $1 == $2/g; s/\@ELSE/.else/g; s/\@ENDIF/.endif/g; diff --git a/make/template/main.mk b/make/template/main.mk index 032fff5e2..fd094b578 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -30,13 +30,12 @@ # -CC = @CC@ +CXX = @CC@ SYSTEM = @SYSTEM@ BUILDPATH = @BUILD_DIR@ SOCKETENGINE = @SOCKETENGINE@ -CXXFLAGS = -pipe -fPIC -DPIC +CORECXXFLAGS = -fPIC -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow LDLIBS = -pthread -lstdc++ -LDFLAGS = CORELDFLAGS = -rdynamic -L. $(LDFLAGS) PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS) BASE = "$(DESTDIR)@BASE_DIR@" @@ -50,12 +49,13 @@ INSTMODE_DIR = 0755 INSTMODE_BIN = 0755 INSTMODE_LIB = 0644 -@IFEQ $(CC) icc - CXXFLAGS += -Wshadow -@ELSE - CXXFLAGS += -pedantic -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall +@IFNEQ $(CXX) icc + CORECXXFLAGS += -pedantic -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute @ENDIF +@IFNEQ $(SYSTEM) darwin + LDLIBS += -pthread +@ENDIF @IFEQ $(SYSTEM) linux LDLIBS += -ldl -lrt @@ -70,19 +70,11 @@ INSTMODE_LIB = 0644 LDLIBS += -lsocket -lnsl -lrt -lresolv INSTALL = ginstall @ENDIF -@IFEQ $(SYSTEM) sunos - LDLIBS += -lsocket -lnsl -lrt -lresolv - INSTALL = ginstall -@ENDIF @IFEQ $(SYSTEM) darwin - CXXFLAGS += -DDARWIN -frtti LDLIBS += -ldl CORELDFLAGS = -dynamic -bind_at_load -L. $(LDFLAGS) PICLDFLAGS = -fPIC -shared -twolevel_namespace -undefined dynamic_lookup $(LDFLAGS) @ENDIF -@IFEQ $(SYSTEM) interix - CXXFLAGS += -D_ALL_SOURCE -I/usr/local/include -@ENDIF @IFNDEF D D=0 @@ -90,48 +82,50 @@ INSTMODE_LIB = 0644 DBGOK=0 @IFEQ $(D) 0 - CXXFLAGS += -O2 -@IFEQ $(CC) gcc - CXXFLAGS += -g1 + CORECXXFLAGS += -O2 +@IFEQ $(CXX) g++ + CORECXXFLAGS += -g1 @ENDIF HEADER = std-header DBGOK=1 @ENDIF @IFEQ $(D) 1 - CXXFLAGS += -O0 -g3 -Werror + CORECXXFLAGS += -O0 -g3 -Werror HEADER = debug-header DBGOK=1 @ENDIF @IFEQ $(D) 2 - CXXFLAGS += -O2 -g3 + CORECXXFLAGS += -O2 -g3 HEADER = debug-header DBGOK=1 @ENDIF FOOTER = finishmessage -CXXFLAGS += -Iinclude - @GNU_ONLY MAKEFLAGS += --no-print-directory @GNU_ONLY SOURCEPATH = $(shell /bin/pwd) @BSD_ONLY SOURCEPATH != /bin/pwd @IFDEF V - RUNCC = $(CC) - RUNLD = $(CC) + RUNCC = $(CXX) + RUNLD = $(CXX) VERBOSE = -v @ELSE @GNU_ONLY MAKEFLAGS += --silent @BSD_ONLY MAKE += -s - RUNCC = perl $(SOURCEPATH)/make/run-cc.pl $(CC) - RUNLD = perl $(SOURCEPATH)/make/run-cc.pl $(CC) + RUNCC = perl $(SOURCEPATH)/make/run-cc.pl $(CXX) + RUNLD = perl $(SOURCEPATH)/make/run-cc.pl $(CXX) @ENDIF @IFDEF PURE_STATIC - CXXFLAGS += -DPURE_STATIC + CORECXXFLAGS += -DPURE_STATIC @ENDIF -@DO_EXPORT RUNCC RUNLD CXXFLAGS LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORELDFLAGS +# Add the users CXXFLAGS to the base ones to allow them to override +# things like -Wfatal-errors if they wish to. +CORECXXFLAGS += $(CXXFLAGS) + +@DO_EXPORT RUNCC RUNLD CORECXXFLAGS LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORELDFLAGS @DO_EXPORT SOURCEPATH BUILDPATH PURE_STATIC SPLIT_CC # Default target @@ -270,8 +264,6 @@ deinstall: -rm -f $(BASE)/.gdbargs -rm -f $(BASE)/org.inspircd.plist -squeakyclean: distclean - configureclean: rm -f .config.cache rm -f BSDmakefile @@ -312,4 +304,4 @@ help: @echo ' deinstall Removes the files created by "make install"' @echo -.PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall squeakyclean configureclean help +.PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall configureclean help diff --git a/make/unit-cc.pl b/make/unit-cc.pl index 7474365aa..df718cdb8 100755 --- a/make/unit-cc.pl +++ b/make/unit-cc.pl @@ -97,7 +97,7 @@ sub do_compile { my $libs = ''; my $binary = $ENV{RUNCC}; if ($do_compile) { - $flags = $ENV{CXXFLAGS}; + $flags = $ENV{CORECXXFLAGS}; $flags =~ s/ -pedantic// if nopedantic($file); $flags .= ' ' . getcompilerflags($file); |