1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
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,11 +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)))
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \>= 1)))
@@ -293,20 +290,8 @@
endif
-ifneq ($(RELEASE)$(DEBUGANYWAY),10)
- # debug build or DEBUGANYWAY=1 --> -g flag
- ifneq (0,$(CLANG))
- 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)))
@@ -328,9 +313,6 @@
debug+= -DUSING_LTO -flto
endif
else
- # Debugging enabled
- debug+= -O0
-
ifeq (0,$(DEBUGANYWAY))
debug+= -DDEBUGGINGAIDS
else
@@ -411,7 +393,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/src
@@ -424,7 +406,7 @@
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
@@ -436,7 +418,7 @@
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
|