summaryrefslogtreecommitdiff
path: root/makefiles/gmake/compiler.mk
diff options
context:
space:
mode:
Diffstat (limited to 'makefiles/gmake/compiler.mk')
-rw-r--r--makefiles/gmake/compiler.mk100
1 files changed, 33 insertions, 67 deletions
diff --git a/makefiles/gmake/compiler.mk b/makefiles/gmake/compiler.mk
index 01e9837..062a30b 100644
--- a/makefiles/gmake/compiler.mk
+++ b/makefiles/gmake/compiler.mk
@@ -33,9 +33,7 @@ GCC_MINOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --gcc-minor-ver
# -fstack-protector-all: does something funny to the shared objects..
# -Wstack-protector makes no sense without SSP
# everything implied by -Wall is not explicitly specified (gcc 4.2.3)
-# TODO: reenable -O2
# -Waggregate-return: is for K&R code and mostly useless nowadays
-# -Wno-long-long: sqlite.h on FreeBSD 6.2 shows problems otherwise
# compilation flags and compilers
COMMON_COMPILE_FLAGS = \
@@ -119,13 +117,13 @@ endif
endif
-CCPP_COMPILE_FLAGS = \
+CXX_COMPILE_FLAGS = \
$(COMMON_COMPILE_FLAGS) \
-std=c++98
# gcc 4.x
ifeq "$(GCC_MAJOR_VERSION)" "4"
-CCPP_COMPILE_FLAGS += \
+CXX_COMPILE_FLAGS += \
-Wno-invalid-offsetof -funit-at-a-time
endif
@@ -133,38 +131,25 @@ ifeq "$(GCC_MAJOR_VERSION)" "3"
# gcc 3.4, not tested yet
ifeq "$(GCC_MINOR_VERSION)" "4"
-CCPP_COMPILE_FLAGS += \
+CXX_COMPILE_FLAGS += \
-Wno-invalid-offsetof
endif
# gcc 3.3, testend on OpenBSD 4.2
ifeq "$(GCC_MINOR_VERSION)" "3"
-#CCPP_COMPILE_FLAGS += \
+#CXX_COMPILE_FLAGS += \
# -Wdeclaration-after-statement
endif
endif
#CC = gcc
-CCPP = g++
+CXX = g++
endif
# end of gcc section
-# start of tcc section
-
-# currently we don't need this, the tcc flags are fairly consistent
-#TCC_MAJOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --tcc-major-version $(CC) "$(CURDIR)" $(TOPDIR))
-#TCC_MINOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --tcc-minor-version $(CC) "$(CURDIR)" $(TOPDIR))
-
-ifeq "$(COMPILER)" "tcc"
-COMPILE_FLAGS = \
- -Wall -Werror
-endif
-
-# end of tcc section
-
# start of icc section
# currently we don't need this, the icc flags are fairly consistent
@@ -183,33 +168,29 @@ endif
# start of spro section
# -xc99=all: full C99 compliance for the code (syntax and library functions)
-# -Xc: full ISO compliance, no K&R stuf
# -mt: enable mutlithreading (-D_REENTRANT for header files, -lthread for ld)
# -errwarn=%all: convert all warnings to errors
-# -v: do more restrictive syntax checking
-# TODO: enable -O2
ifeq "$(COMPILER)" "spro"
+
+CC=CC
+CXX=CC
+
STD99_COMPILE_FLAGS = \
-xc99=all
-COMPILE_FLAGS = \
- $(STD99_COMPILE_FLAGS) -Xc -errwarn=%all -mt -v
-endif
-# end of spro section
+COMMON_COMPILE_FLAGS = \
+ -errwarn=%all -mt
-# start of pcc section
+COMPILE_FLAGS = \
+ $(STD99_COMPILE_FLAGS) $(COMMON_COMPILE_FLAGS)
-# currently we don't need this, the pcc flags are fairly consistent
-#PCC_MAJOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --pcc-major-version $(CC) "$(CURDIR)" $(TOPDIR))
-#PCC_MINOR_VERSION ?= $(shell $(TOPDIR)/makefiles/gmake/guess_env --pcc-minor-version $(CC) "$(CURDIR)" $(TOPDIR))
+CXX_COMPILE_FLAGS = \
+ $(COMMON_COMPILE_FLAGS)
-ifeq "$(COMPILER)" "pcc"
-COMPILE_FLAGS = \
- --fatal-warnings
endif
-# end of pcc section
+# end of spro section
# set flags for threading support using POSIX threads. This is completly different
# between compiler/platforms
@@ -244,17 +225,8 @@ PTHREADS_CFLAGS =
PTHREADS_LDFLAGS =
PTHREADS_LIBS =
endif
-endif
-ifeq "$(COMPILER)" "tcc"
-ifeq "$(PLATFORM)" "LINUX"
-PTHREADS_CFLAGS = -D_REENTRANT
-PTHREADS_LDFLAGS =
-PTHREADS_LIBS = -lpthread
-endif
-endif
-
-ifeq "$(COMPILER)" "pcc"
+ifeq "$(COMPILER)" "icc"
ifeq "$(PLATFORM)" "LINUX"
PTHREADS_CFLAGS = -D_REENTRANT -pthread
PTHREADS_LDFLAGS = -pthread
@@ -262,12 +234,6 @@ PTHREADS_LIBS =
endif
endif
-ifeq "$(COMPILER)" "icc"
-ifeq "$(PLATFORM)" "LINUX"
-PTHREADS_CFLAGS = -D_REENTRANT -pthread
-PTHREADS_LDFLAGS = -pthread
-PTHREADS_LIBS =
-endif
endif
# set flags for position independend code (as required for shared libraries
@@ -309,36 +275,36 @@ endif
#endif
#endif
-CFLAGS = $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(PTHREADS_CFLAGS)
-CCPPFLAGS = $(CCPP_COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(PTHREADS_CFLAGS)
+ALL_CFLAGS = $(CFLAGS) $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(INCLUDE_CFLAGS) $(PTHREADS_CFLAGS)
+ALL_CXXFLAGS = $(CXXFLAGS) $(CXX_COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(INCLUDE_CXXFLAGS) $(PTHREADS_CFLAGS)
+ALL_LDFLAGS = $(LDFLAGS) $(INCLUDE_LDFLAGS) $(PTHREADS_LDFLAGS) $(LDFLAGS_NET) $(LDFLAGS_LT) $(LDFLAGS_DL)
-LDFLAGS = $(INCLUDE_LDFLAGS) $(PTHREADS_LDFLAGS) $(LDFLAGS_NET) $(LDFLAGS_LT)
-LIBS = $(INCLUDE_LIBS) $(PTHREADS_LIBS) $(LIBS_NET) $(LIBS_LT)
+LIBS = $(INCLUDE_LIBS) $(PTHREADS_LIBS) $(LIBS_NET) $(LIBS_LT) $(LIBS_DL)
LINK = $(CC)
-CCPP_LINK = $(CCPP)
+CXX_LINK = $(CXX)
%.o : %.c
- $(CC) -c -o $@ $(CFLAGS) $<
+ $(CC) -c -o $@ $(ALL_CFLAGS) $<
%.o : %.cpp
- $(CCPP) -c -o $@ $(CCPPFLAGS) $<
+ $(CXX) -c -o $@ $(ALL_CXXFLAGS) $<
-%$(EXE): %.o $(OBJS) $(TEST_OBJS)
- $(CCPP_LINK) -o $@ $(LDFLAGS) $(OBJS) $(TEST_OBJS) $< $(LIBS)
+%$(EXE): %.o $(OBJS) $(CPP_OBJS)
+ $(CXX_LINK) -o $@ $(ALL_LDFLAGS) $(OBJS) $(CPP_OBJS) $< $(LIBS)
%.sho : %.c
- $(CC) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(CFLAGS) $<
+ $(CC) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(ALL_CFLAGS) $<
#%$(SO) : %.sho $(OBJS)
-# $(LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $<
+# $(LINK) -shared -o $@ $(ALL_LDFLAGS) $(LIBS) $(OBJS) $<
%.sho++ : %.cpp
- $(CCPP) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(CCPPFLAGS) $<
+ $(CXX) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(ALL_CXXFLAGS) $<
+
+#%$(SO) : %.sho++ $(OBJS) $(CPP_OBJS)
+# $(CXX_LINK) -shared -o $@ $(ALL_LDFLAGS) $(LIBS) $(OBJS) $(CPP_OBJS) $<
-#%$(SO) : %.sho++ $(OBJS) $(CPPOBJS)
-# $(CCPP_LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $(CPPOBJS) $<
-
-BIN_OBJS = $(BINS:$(EXE)=.o)
+BIN_OBJS = $(BINS:$(EXE)=.o)
TEST_BIN_OBJS = $(TEST_BINS:$(EXE)=.o)
CPP_BIN_OBJS = $(CPP_BINS:$(EXE)=.o)
TEST_CPP_BIN_OBJS = $(TEST_CPP_BINS:$(EXE)=.o)