You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
154 lines
4.3 KiB
154 lines
4.3 KiB
From: Julian Ospald <hasufell@gentoo.org>
|
|
Date: Sat Feb 2 01:16:21 UTC 2013
|
|
Subject: build system
|
|
|
|
respect CC/CXX etc and CFLAGS/CXXFLAGS/LDFLAGS
|
|
|
|
--- eduke32_20130201-3453/Makefile
|
|
+++ eduke32_20130201-3453/Makefile
|
|
@@ -308,10 +308,10 @@
|
|
endif
|
|
|
|
COMPILER=$(CC) $(OURCONLYFLAGS)
|
|
-LINKER=$(L_CC)
|
|
+LINKER=$(L_CC) $(OURCFLAGS) $(OURCONLYFLAGS)
|
|
ifneq ($(CPLUSPLUS),0)
|
|
COMPILER=$(CXX) $(OURCXXFLAGS)
|
|
- LINKER=$(L_CXX)
|
|
+ LINKER=$(L_CXX) $(OURCXXFLAGS)
|
|
endif
|
|
|
|
ifeq ($(PRETTY_OUTPUT),1)
|
|
--- eduke32_20130201-3453/Makefile.common
|
|
+++ eduke32_20130201-3453/Makefile.common
|
|
@@ -8,13 +8,14 @@
|
|
PRETTY_OUTPUT ?= 1
|
|
|
|
# Tools
|
|
-CC=gcc
|
|
-CXX=g++
|
|
-AS=nasm
|
|
-AR=ar
|
|
-RC=windres
|
|
-RANLIB=ranlib
|
|
-STRIP=strip
|
|
+CC ?= gcc
|
|
+CXX ?= g++
|
|
+AS ?= nasm
|
|
+AR ?= ar
|
|
+RC ?= windres
|
|
+RANLIB ?= ranlib
|
|
+STRIP ?= strip
|
|
+PKG_CONFIG ?= pkgconfig
|
|
|
|
L_CC=$(CC)
|
|
L_CXX=$(CXX)
|
|
@@ -152,7 +153,6 @@
|
|
# FORCEWARNINGS - 1 = do not disable any compiler warnings within the source
|
|
# KRANDDEBUG - 1 = include logging of krand() calls for debugging the demo system
|
|
# EFENCE - 1 = compile with Electric Fence for malloc() debugging
|
|
-# OPTLEVEL - 0..3 = GCC optimization strategy
|
|
# LTO - 1 = enable link-time optimization, for GCC 4.5 and up
|
|
#
|
|
CPLUSPLUS?=0
|
|
@@ -163,7 +163,6 @@
|
|
FORCEWARNINGS?=0
|
|
EFENCE?=0
|
|
DMALLOC?=0
|
|
-OPTLEVEL?=2
|
|
PROFILER?=0
|
|
MUDFLAP?=0
|
|
|
|
@@ -269,10 +268,9 @@
|
|
|
|
# compiler flags etc.
|
|
BASECFLAGS=
|
|
-BASECONLYFLAGS=-Wimplicit -Wdeclaration-after-statement
|
|
-BASECXXFLAGS= -fno-exceptions -fno-rtti -fpermissive -Wno-write-strings -Wno-narrowing
|
|
-BASEASFLAGS=-s #-g
|
|
-BASELDFLAGS=
|
|
+BASECONLYFLAGS = $(CFLAGS) -std=gnu89 -Wimplicit -Wdeclaration-after-statement
|
|
+BASECXXFLAGS = $(CXXFLAGS) -fno-exceptions -fno-rtti -fpermissive -Wno-write-strings -Wno-narrowing
|
|
+BASELDFLAGS = $(LDFLAGS)
|
|
|
|
|
|
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4)))
|
|
@@ -300,14 +298,11 @@
|
|
debug=-g
|
|
else ifeq ($(PLATFORM), WII)
|
|
debug=-g
|
|
- else
|
|
- debug=-ggdb
|
|
endif
|
|
endif
|
|
|
|
ifneq (0,$(RELEASE))
|
|
# Debugging disabled
|
|
- debug+= -O$(OPTLEVEL)
|
|
ifeq (0,$(CLANG))
|
|
debug+= -funswitch-loops
|
|
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \< 4)))
|
|
@@ -330,7 +325,6 @@
|
|
endif
|
|
else
|
|
# Debugging enabled
|
|
- debug+= -O0
|
|
|
|
ifeq (0,$(DEBUGANYWAY))
|
|
debug+= -DDEBUGGINGAIDS
|
|
@@ -411,7 +405,7 @@
|
|
|
|
#### Lunatic development, do not touch!
|
|
LUNATIC=0
|
|
-LUAJIT=luajit
|
|
+LUAJIT=$(shell command -v luajit || command -v luajit-2 || command -v luajit-2.0)
|
|
|
|
# for LJ headers:
|
|
LUAJIT_WIN_SRC:= g:/mod/LuaJIT-2.0.0-beta8/src
|
|
@@ -424,14 +418,14 @@
|
|
ifeq ($(PLATFORM),WINDOWS)
|
|
BASECOMMONFLAGS+= -I$(LUAJIT_WIN_SRC)
|
|
else
|
|
- BASECOMMONFLAGS+= -I/usr/local/include/luajit-2.0
|
|
+ BASECOMMONFLAGS+= $(shell $(PKG_CONFIG) --cflags luajit 2>/dev/null || $(PKG_CONFIG) --cflags luajit-2.0)
|
|
endif
|
|
BASECOMMONFLAGS+= -I$(SRC)/lunatic -DLUNATIC
|
|
|
|
ifeq ($(PLATFORM),WINDOWS)
|
|
BASELIBS+= -lluajit
|
|
else
|
|
- BASELIBS+= -lluajit-5.1
|
|
+ BASELIBS+= $(shell $(PKG_CONFIG) --libs luajit 2>/dev/null || $(PKG_CONFIG) --libs luajit-2.0)
|
|
endif
|
|
endif
|
|
|
|
--- eduke32_20130201-3453/build/Makefile
|
|
+++ eduke32_20130201-3453/build/Makefile
|
|
@@ -166,13 +166,15 @@
|
|
OURCOMMONFLAGS+= $(BUILDCOMMONFLAGS)
|
|
|
|
COMPILER=$(CC) $(OURCONLYFLAGS)
|
|
-LINKER=$(L_CC)
|
|
+LINKER=$(L_CC) $(OURCFLAGS) $(OURCONLYFLAGS)
|
|
ifneq ($(CPLUSPLUS),0)
|
|
COMPILER=$(CXX) $(OURCXXFLAGS)
|
|
- LINKER=$(L_CXX)
|
|
+ LINKER=$(L_CXX) $(OURCXXFLAGS)
|
|
endif
|
|
|
|
+ifeq ($(PRETTY_OUTPUT),1)
|
|
.SILENT:
|
|
+endif
|
|
.PHONY: clean cleanutils veryclean all utils dxutils sdlutils printutils printsdlutils printdxutils enginelib editorlib
|
|
|
|
# TARGETS
|
|
@@ -265,7 +267,7 @@
|
|
if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS) -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL; then $(ONESTEP_OK); else $(ONESTEP_FAILED); fi
|
|
arttool$(EXESUFFIX): $(OBJ)/arttool.$o $(UTILADDOBJS)
|
|
$(ONESTEP_STATUS)
|
|
- if $(L_CXX) -o $@ $^ $(OURLDFLAGS) $(STATICSTDCPP) $(STDCPPLIB) $(UTILLIBS); then $(ONESTEP_OK); else $(ONESTEP_FAILED); fi
|
|
+ if $(L_CXX) $(OURCXXFLAGS) -o $@ $^ $(OURLDFLAGS) $(STATICSTDCPP) $(STDCPPLIB) $(UTILLIBS); then $(ONESTEP_OK); else $(ONESTEP_FAILED); fi
|
|
givedepth$(EXESUFFIX): $(OBJ)/givedepth.$o $(UTILADDOBJS)
|
|
$(ONESTEP_STATUS)
|
|
if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); else $(ONESTEP_FAILED); fi
|