Subversion Repositories eduke32

Rev

Rev 4319 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
996 terminx 1
#
5 Plagman 2
# EDuke32 Makefile for GNU Make
996 terminx 3
#
5 Plagman 4
 
1739 helixhorne 5
include Makefile.common
996 terminx 6
 
1103 terminx 7
 
996 terminx 8
# Build locations
3163 hendricks2 9
#
285 terminx 10
SRC=source
11
RSRC=rsrc
12
ESRC=$(EROOT)/src
13
EINC=$(EROOT)/include
5 Plagman 14
INC=$(SRC)
15
o=o
1128 terminx 16
# ENETROOT=$(ESRC)/enet
5 Plagman 17
 
18
ifneq (0,$(RELEASE))
1693 helixhorne 19
    # Debugging disabled
1739 helixhorne 20
    debug+= $(F_NO_STACK_PROTECTOR)
5 Plagman 21
else
1693 helixhorne 22
    # Debugging enabled
1665 terminx 23
    ifneq (0,$(KRANDDEBUG))
1739 helixhorne 24
        debug+= -fno-inline -fno-inline-functions -fno-inline-functions-called-once
1665 terminx 25
    endif
5 Plagman 26
endif
27
 
3122 hendricks2 28
OURCOMMONFLAGS=$(BASECOMMONFLAGS) \
3193 terminx 29
    -I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include
3122 hendricks2 30
OURCFLAGS=$(OURCOMMONFLAGS) $(BASECFLAGS)
1739 helixhorne 31
OURCXXFLAGS=$(BASECXXFLAGS)
2458 hendricks2 32
OURCONLYFLAGS=$(BASECONLYFLAGS)
2520 hendricks2 33
OURASFLAGS=$(BASEASFLAGS)
3122 hendricks2 34
PRINTLDFLAGS=$(BASELDFLAGS)
35
OURLDFLAGS=$(OURCOMMONFLAGS) $(PRINTLDFLAGS)
1739 helixhorne 36
 
3057 helixhorne 37
# Game/editor-specific linker options
38
GAMELDFLAGS=
39
EDITORLDFLAGS=
1739 helixhorne 40
 
3219 hendricks2 41
LIBS=
3278 hendricks2 42
LIBDIRS=
3219 hendricks2 43
 
1469 terminx 44
JAUDIOLIBDIR=$(SRC)/jaudiolib
45
JAUDIOLIB=libjfaudiolib.a
46
 
1552 terminx 47
ENETDIR=$(SRC)/enet
48
ENETLIB=libenet.a
49
 
3260 helixhorne 50
ifeq ($(NETCODE),0)
51
    ENET_TARGET=
52
else
53
    ENET_TARGET=$(ENETDIR)/$(ENETLIB)
54
endif
2037 helixhorne 55
 
3260 helixhorne 56
 
1739 helixhorne 57
include $(EROOT)/Makefile.shared
352 terminx 58
 
3278 hendricks2 59
# The reasoning for this order is so SDL_mixer can link to SDL, etc.
60
OURLIBS=$(LIBDIRS) $(BASELIBDIRS) $(BUILDLIBDIRS) $(LIBS) $(BASELIBS) $(BUILDLIBS)
3219 hendricks2 61
 
62
 
3096 hendricks2 63
EDUKE32 ?= eduke32$(EXESUFFIX)
64
MAPSTER32 ?= mapster32$(EXESUFFIX)
65
 
66
EDUKE32_TARGET:=$(EDUKE32)
3582 hendricks2 67
MAPSTER32_TARGET:=$(MAPSTER32)
3096 hendricks2 68
 
3299 hendricks2 69
ifndef EBACKTRACEDLL
70
    EBACKTRACEDLL = ebacktrace1.dll
71
    ifeq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
72
        EBACKTRACEDLL = ebacktrace1-64.dll
73
    endif
74
endif
3236 hendricks2 75
EBACKTRACEDLL_TARGET:=$(EBACKTRACEDLL)
3096 hendricks2 76
 
1627 terminx 77
ifeq ($(PLATFORM),WINDOWS)
3551 terminx 78
    OBJ=$(SRC)/obj_win
79
    EOBJ=$(SRC)/eobj_win
1627 terminx 80
else
3272 hendricks2 81
    ifeq ($(SUBPLATFORM),LINUX)
3278 hendricks2 82
        LIBS+= -lrt
1879 plagman 83
    endif
3551 terminx 84
    OBJ=$(SRC)/obj
85
    EOBJ=$(SRC)/eobj
1627 terminx 86
endif
5 Plagman 87
 
1672 terminx 88
JMACTOBJ=$(OBJ)/file_lib.$o \
285 terminx 89
	$(OBJ)/control.$o \
90
	$(OBJ)/keyboard.$o \
91
	$(OBJ)/mouse.$o \
2728 hendricks2 92
	$(OBJ)/joystick.$o \
285 terminx 93
	$(OBJ)/mathutil.$o \
1105 terminx 94
	$(OBJ)/scriplib.$o \
95
	$(OBJ)/animlib.$o
5 Plagman 96
 
285 terminx 97
GAMEOBJS=$(OBJ)/game.$o \
98
	$(OBJ)/actors.$o \
99
	$(OBJ)/anim.$o \
2542 helixhorne 100
	$(OBJ)/common.$o \
285 terminx 101
	$(OBJ)/config.$o \
1677 terminx 102
	$(OBJ)/demo.$o \
285 terminx 103
	$(OBJ)/gamedef.$o \
104
	$(OBJ)/gameexec.$o \
399 terminx 105
	$(OBJ)/gamevars.$o \
285 terminx 106
	$(OBJ)/global.$o \
2728 hendricks2 107
	$(OBJ)/input.$o \
285 terminx 108
	$(OBJ)/menus.$o \
109
	$(OBJ)/namesdyn.$o \
1677 terminx 110
	$(OBJ)/net.$o \
285 terminx 111
	$(OBJ)/player.$o \
112
	$(OBJ)/premap.$o \
113
	$(OBJ)/savegame.$o \
114
	$(OBJ)/sector.$o \
115
	$(OBJ)/rts.$o \
116
	$(OBJ)/osdfuncs.$o \
117
	$(OBJ)/osdcmds.$o \
337 terminx 118
	$(OBJ)/grpscan.$o \
1469 terminx 119
	$(OBJ)/sounds.$o \
3834 hendricks2 120
	$(OBJ)/soundsdyn.$o \
5 Plagman 121
	$(JMACTOBJ)
122
 
1247 helixhorne 123
EDITOROBJS=$(OBJ)/astub.$o \
2542 helixhorne 124
	$(OBJ)/common.$o \
1493 helixhorne 125
	$(OBJ)/m32def.$o \
126
	$(OBJ)/m32exec.$o \
127
	$(OBJ)/m32vars.$o \
1739 helixhorne 128
	$(OBJ)/mathutil.$o \
129
	$(OBJ)/sounds_mapster32.$o
5 Plagman 130
 
1933 helixhorne 131
ifneq ($(USE_LIBVPX),0)
132
    GAMEOBJS+= $(OBJ)/animvpx.$o
133
endif
2034 helixhorne 134
 
3116 hendricks2 135
ifneq (0,$(DISABLEINLINING))
136
    GAMEOBJS+= $(OBJ)/game_inline.$o \
137
	$(OBJ)/actors_inline.$o \
138
	$(OBJ)/sector_inline.$o
139
endif
140
 
2148 helixhorne 141
MISCGAMEDEPS=
3248 helixhorne 142
MISCEDITORDEPS=
2143 helixhorne 143
 
2148 helixhorne 144
 
2143 helixhorne 145
## Lunatic devel
2034 helixhorne 146
ifneq (0,$(LUNATIC))
4237 helixhorne 147
    LUNATIC_COMMON_OBJS = \
148
        $(OBJ)/luaJIT_BC_defs_common.$o \
149
        $(OBJ)/luaJIT_BC_engine_maptext.$o \
150
        $(OBJ)/luaJIT_BC_engine.$o \
151
        $(OBJ)/luaJIT_BC_bcarray.$o \
152
        $(OBJ)/luaJIT_BC_bcheck.$o \
153
        $(OBJ)/luaJIT_BC_bitar.$o \
154
        $(OBJ)/luaJIT_BC_xmath.$o \
155
        $(OBJ)/luaJIT_BC_v.$o \
156
        $(OBJ)/luaJIT_BC_dump.$o \
157
        $(OBJ)/luaJIT_BC_dis_x86.$o \
158
        $(OBJ)/luaJIT_BC_dis_x64.$o \
159
 
160
    # TODO: remove debugging modules from release build
161
 
3733 helixhorne 162
    EDITOROBJS+= $(OBJ)/lunatic_m32.$o $(LUNATIC_COMMON_OBJS)
163
    GAMEOBJS+= $(OBJ)/lunatic_game.$o $(LUNATIC_COMMON_OBJS)
2143 helixhorne 164
 
4237 helixhorne 165
    EDITOROBJS+= $(OBJ)/luaJIT_BC_defs_m32.$o
166
 
3938 helixhorne 167
    ifneq ($(PLATFORM),WINDOWS)
168
        # On non-Windows, we expect to have liblpeg.a (or a symlink to it) in source/.
4319 hendricks2 169
        # On Windows, it will reside in platform/Windows/lib/32/ or lib/64/.
3940 helixhorne 170
        LIBDIRS+= -L$(OBJ)/..
3938 helixhorne 171
        ifeq ($(realpath $(OBJ)/../liblpeg.a),)
172
            # XXX: This cripples "make clean" etc. too, but IMO it's better than warning.
173
            $(error "liblpeg.a not found in $(realpath $(OBJ)/..)")
174
        endif
175
    endif
176
    LIBS+= -llpeg
2650 helixhorne 177
    GAMEOBJS+= $(OBJ)/luaJIT_BC_con_lang.$o \
2855 helixhorne 178
               $(OBJ)/luaJIT_BC_lunacon.$o \
2858 helixhorne 179
               $(OBJ)/luaJIT_BC_randgen.$o \
2862 helixhorne 180
               $(OBJ)/luaJIT_BC_stat.$o \
3435 helixhorne 181
               $(OBJ)/luaJIT_BC_control.$o \
3517 helixhorne 182
               $(OBJ)/luaJIT_BC_defs.$o \
3796 helixhorne 183
               $(OBJ)/luaJIT_BC_savegame.$o \
4147 helixhorne 184
               $(OBJ)/luaJIT_BC_fs.$o \
2650 helixhorne 185
 
2143 helixhorne 186
    # now, take care of having the necessary symbols (sector, wall, etc.) in the
187
    # executable no matter what the debugging level
188
 
2074 helixhorne 189
    ifeq ($(PLATFORM),DARWIN)
2143 helixhorne 190
        # strip on OSX says: removing global symbols from a final linked no longer supported.
191
        #                    Use -exported_symbols_list at link time when building
192
        # But, following _their_ directions does not give us the symbols! wtf?
3422 helixhorne 193
        ifneq ($(STRIP),0)
194
            STRIP+= -s $(SRC)/lunatic/dynsymlist_osx
195
        endif
2143 helixhorne 196
 
2148 helixhorne 197
        MISCGAMEDEPS+= $(SRC)/lunatic/dynsymlist_osx
3122 hendricks2 198
        PRINTLDFLAGS+= -pagezero_size 10000 -image_base 100000000 #-Wl,-alias_list -Wl,$(SRC)/lunatic/aliases_list #-exported_symbols_list $(SRC)/lunatic/dynsymlist_osx
2143 helixhorne 199
    endif
200
    ifeq ($(PLATFORM),WINDOWS)
3423 helixhorne 201
        override STRIP=
2148 helixhorne 202
        MISCGAMEDEPS+= $(SRC)/lunatic/eduke32.def
3248 helixhorne 203
        GAMELDFLAGS+= $(SRC)/lunatic/eduke32.def
204
        MISCEDITORDEPS+= $(SRC)/lunatic/mapster32.def
205
        EDITORLDFLAGS+= $(SRC)/lunatic/mapster32.def
2143 helixhorne 206
    endif
3272 hendricks2 207
    ifeq ($(SUBPLATFORM),LINUX)
3423 helixhorne 208
        override STRIP=
3057 helixhorne 209
        GAMELDFLAGS+= -Wl,--dynamic-list=$(SRC)/lunatic/dynsymlist
210
        EDITORLDFLAGS+= -Wl,--dynamic-list=$(SRC)/lunatic/dynsymlist_m32
2074 helixhorne 211
    endif
2034 helixhorne 212
endif
213
 
2143 helixhorne 214
 
996 terminx 215
# PLATFORM SPECIFIC SETTINGS
216
 
3272 hendricks2 217
ifeq ($(SUBPLATFORM),LINUX)
2672 helixhorne 218
    ifeq (0,$(CLANG))
3122 hendricks2 219
        OURCOMMONFLAGS	+= -fno-pic
2159 helixhorne 220
    endif
2520 hendricks2 221
    OURASFLAGS	+= -f elf
3335 hendricks2 222
    LIBS		+= -lFLAC -lvorbisfile -lvorbis -logg
996 terminx 223
endif
224
 
225
ifeq ($(PLATFORM),DARWIN)
3275 hendricks2 226
    OURCOMMONFLAGS += -fno-pic
3334 hendricks2 227
    LIBDIRS += -L$(abspath $(JAUDIOLIBDIR)/third-party/Apple/lib)
2537 hendricks2 228
 
229
    ifneq ($(findstring x86_64,$(ARCH)),x86_64)
230
        ifeq (,$(ARCH))
231
            ifneq ($(findstring x86_64,$(SYSARCH)),x86_64)
232
                LIBS += -read_only_relocs suppress
233
            endif
234
        else
235
            LIBS += -read_only_relocs suppress
236
        endif
237
    endif
238
 
1693 helixhorne 239
    ifeq (1,$(SDL_FRAMEWORK))
3122 hendricks2 240
        OURCOMMONFLAGS += -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \
2398 hendricks2 241
                -I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers
2537 hendricks2 242
 
3335 hendricks2 243
        LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lm \
3551 terminx 244
                -Wl,-framework,SDL -Wl,-framework,SDL_mixer platform/Apple/lib/libSDLmain.a \
1693 helixhorne 245
                -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
246
                -Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
247
                -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
2425 hendricks2 248
                -Wl,-framework,QuickTime -lm \
2399 hendricks2 249
                -Wl,-rpath -Wl,"@loader_path/../Frameworks"
1905 helixhorne 250
        # We have SDLMain.m from the OSX SDL package in the Apple/ subdir:
251
        EDITOROBJS+=$(OBJ)/SDLMain.$o
252
        GAMEOBJS+=$(OBJ)/SDLMain.$o
1693 helixhorne 253
    else
3122 hendricks2 254
        OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
3335 hendricks2 255
        LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \
1693 helixhorne 256
                -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
257
                -Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
258
                -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
259
                -Wl,-framework,QuickTime -lm
260
    endif
2537 hendricks2 261
 
2426 hendricks2 262
    ifneq (0,$(OSX_STARTUPWINDOW))
3334 hendricks2 263
        GAMEOBJS+=$(OBJ)/GrpFile.game.$o $(OBJ)/GameListSource.game.$o $(OBJ)/startosx.game.$o
2426 hendricks2 264
    endif
2537 hendricks2 265
 
2520 hendricks2 266
    OURASFLAGS += -f macho
996 terminx 267
endif
268
 
5 Plagman 269
ifeq ($(PLATFORM),WINDOWS)
3219 hendricks2 270
    OURCOMMONFLAGS	+= -fno-pic -DUNDERSCORES
2520 hendricks2 271
    OURASFLAGS+= -DUNDERSCORES -f win32
3335 hendricks2 272
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg
3334 hendricks2 273
    LIBDIRS += -L$(abspath $(JAUDIOLIBDIR)/third-party/Windows/lib$(WINLIB))
3219 hendricks2 274
    GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o
1693 helixhorne 275
    EDITOROBJS+= $(OBJ)/buildres.$o
1469 terminx 276
    JAUDIOLIB=libjfaudiolib_win32.a
1552 terminx 277
    ENETLIB=libenet_win32.a
4084 hendricks2 278
    OURCOMMONFLAGS += -I$(DXROOT) -I$(DXROOT)/include
279
    ifeq ($(MIXERTYPE),WIN)
3219 hendricks2 280
        LIBS+= -ldsound
281
        GAMEOBJS+= $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o
282
    endif
283
endif
1693 helixhorne 284
# -lGLU to build with gluBuild2DMipmaps
3219 hendricks2 285
ifeq ($(RENDERTYPE),SDL)
4084 hendricks2 286
    ifeq (1,$(HAVE_GTK2))
287
        OURCOMMONFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
288
        GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o
289
        EDITOROBJS+= $(OBJ)/editor_banner.$o
290
    endif
291
 
292
    GAMEOBJS+= $(OBJ)/game_icon.$o
293
    EDITOROBJS+= $(OBJ)/build_icon.$o
294
endif
295
ifeq ($(MIXERTYPE),SDL)
3219 hendricks2 296
    ifeq ($(PLATFORM),WINDOWS)
3275 hendricks2 297
        OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
4074 hendricks2 298
        ifeq ($(SDL_TARGET),1)
299
            LIBS+= platform/Windows/lib$(WINLIB)/SDL_mixer.lib
300
        else
301
            LIBS+= -l$(SDLNAME)_mixer
302
        endif
3278 hendricks2 303
        LIBDIRS+= -L$(SDLROOT)/lib
3219 hendricks2 304
    else
305
        ifneq ($(PLATFORM),DARWIN)
2777 helixhorne 306
            LIBS+= -l$(SDLNAME)_mixer
1693 helixhorne 307
        endif
3219 hendricks2 308
    endif
5 Plagman 309
 
4084 hendricks2 310
    GAMEOBJS+= $(OBJ)/sdlmusic.$o
5 Plagman 311
endif
312
 
1473 terminx 313
 
3122 hendricks2 314
OURCOMMONFLAGS+= $(BUILDCOMMONFLAGS)
5 Plagman 315
 
1752 plagman 316
ifeq ($(PLATFORM),WINDOWS)
3278 hendricks2 317
    ifneq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
318
        PRINTLDFLAGS+= -Wl,--large-address-aware
319
    endif
1751 helixhorne 320
endif
2084 helixhorne 321
#ifneq (0,$(KRANDDEBUG))
2116 helixhorne 322
ifeq ($(PLATFORM),DARWIN)
3122 hendricks2 323
    PRINTLDFLAGS+=-Wl,-map -Wl,$@.memmap
2116 helixhorne 324
else
3122 hendricks2 325
    PRINTLDFLAGS+=-Wl,-Map=$@.memmap
2116 helixhorne 326
endif
2084 helixhorne 327
#endif
1693 helixhorne 328
ifneq (0,$(PROFILER))
3122 hendricks2 329
    PRINTLDFLAGS+=-pg
1693 helixhorne 330
endif
2622 helixhorne 331
ifeq ($(PLATFORM),WII)
3122 hendricks2 332
    PRINTLDFLAGS+= -mrvl -meabi -mhard-float -Wl,--gc-sections -Wl,-Map,$(notdir $@).map
2685 hendricks2 333
    # -msdata=eabi
2622 helixhorne 334
endif
1595 helixhorne 335
 
3122 hendricks2 336
COMPILER=$(CC) $(OURCONLYFLAGS)
337
LINKER=$(L_CC)
3116 hendricks2 338
ifneq ($(CPLUSPLUS),0)
3122 hendricks2 339
    COMPILER=$(CXX) $(OURCXXFLAGS)
340
    LINKER=$(L_CXX)
3116 hendricks2 341
endif
342
 
1103 terminx 343
ifeq ($(PRETTY_OUTPUT),1)
1101 terminx 344
.SILENT:
1103 terminx 345
endif
1552 terminx 346
.PHONY: clean all engine $(EOBJ)/$(ENGINELIB) $(EOBJ)/$(EDITORLIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB)
5 Plagman 347
 
348
# TARGETS
349
 
3163 hendricks2 350
UTILOBJS=$(OBJ)/ivfrate.$o
351
UTILS=ivfrate$(EXESUFFIX)
5 Plagman 352
 
4343 hendricks2 353
all: start $(DO_REV) $(EDUKE32_TARGET) $(MAPSTER32_TARGET) finish
2685 hendricks2 354
ifneq (,$(EDUKE32_TARGET))
3096 hendricks2 355
	@ls -l $(EDUKE32)
2685 hendricks2 356
endif
357
ifneq (,$(MAPSTER32_TARGET))
3096 hendricks2 358
	@ls -l $(MAPSTER32)
2685 hendricks2 359
endif
3236 hendricks2 360
 
361
ebacktrace: start $(EBACKTRACEDLL_TARGET) finish
3163 hendricks2 362
ifneq (,$(EBACKTRACEDLL_TARGET))
363
	@ls -l $(EBACKTRACEDLL)
364
endif
1101 terminx 365
 
3163 hendricks2 366
utils: start $(UTILS) finish
367
	@ls -l $(UTILS)
368
 
369
start:
1102 terminx 370
	$(BUILD_STARTED)
1595 helixhorne 371
 
3163 hendricks2 372
finish:
373
	$(BUILD_FINISHED)
3096 hendricks2 374
 
3163 hendricks2 375
 
3260 helixhorne 376
$(EDUKE32): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENET_TARGET) $(MISCGAMEDEPS)
1102 terminx 377
	$(LINK_STATUS)
3720 helixhorne 378
	if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(GAMELDFLAGS) $(OURLIBS) $(STATICSTDCPP); then $(LINK_OK); else $(LINK_FAILED); fi
3422 helixhorne 379
ifneq ($(STRIP),)
380
	$(STRIP) $(EDUKE32)
1101 terminx 381
endif
2385 hendricks2 382
ifeq ($(PLATFORM),DARWIN)
3551 terminx 383
	cp -RPf "platform/Apple/bundles/EDuke32.app" "./"
2388 helixhorne 384
	mkdir -p "EDuke32.app/Contents/MacOS"
3096 hendricks2 385
	cp -f "$(EDUKE32)" "EDuke32.app/Contents/MacOS/"
2385 hendricks2 386
endif
1595 helixhorne 387
 
3248 helixhorne 388
$(MAPSTER32): $(EDITOROBJS) $(EOBJ)/$(ENGINELIB) $(EOBJ)/$(EDITORLIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(MISCEDITORDEPS)
1102 terminx 389
	$(LINK_STATUS)
3720 helixhorne 390
	if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(EDITORLDFLAGS) $(OURLIBS) $(STATICSTDCPP); then $(LINK_OK); else $(LINK_FAILED); fi
3422 helixhorne 391
ifneq ($(STRIP),)
392
	$(STRIP) $(MAPSTER32)
1693 helixhorne 393
endif
2385 hendricks2 394
ifeq ($(PLATFORM),DARWIN)
3551 terminx 395
	cp -RPf "platform/Apple/bundles/Mapster32.app" "./"
2388 helixhorne 396
	mkdir -p "Mapster32.app/Contents/MacOS"
3096 hendricks2 397
	cp -f "$(MAPSTER32)" "Mapster32.app/Contents/MacOS/"
2385 hendricks2 398
endif
5 Plagman 399
 
400
include Makefile.deps
401
 
402
.PHONY: enginelib editorlib
403
enginelib editorlib:
350 terminx 404
	-mkdir -p $(EOBJ)
1109 terminx 405
ifeq ($(PRETTY_OUTPUT),1)
1143 terminx 406
	printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(EROOT)\033[0;35m \033[0m\n"
1739 helixhorne 407
endif
2148 helixhorne 408
	$(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" $@ LUNATIC=$(LUNATIC)
1693 helixhorne 409
ifeq ($(PRETTY_OUTPUT),1)
1143 terminx 410
	printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n"
1109 terminx 411
endif
1595 helixhorne 412
 
285 terminx 413
$(EOBJ)/$(ENGINELIB): enginelib
414
$(EOBJ)/$(EDITORLIB): editorlib
1469 terminx 415
$(JAUDIOLIBDIR)/$(JAUDIOLIB):
416
ifeq ($(PRETTY_OUTPUT),1)
417
	printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(JAUDIOLIBDIR)\033[0;35m \033[0m\n"
418
endif
2632 helixhorne 419
	$(MAKE) -C $(JAUDIOLIBDIR)
1469 terminx 420
ifeq ($(PRETTY_OUTPUT),1)
421
	printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n"
422
endif
5 Plagman 423
 
1552 terminx 424
$(ENETDIR)/$(ENETLIB):
425
ifeq ($(PRETTY_OUTPUT),1)
426
	printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(ENETDIR)\033[0;35m \033[0m\n"
427
endif
2632 helixhorne 428
	$(MAKE) -C $(ENETDIR)
1552 terminx 429
ifeq ($(PRETTY_OUTPUT),1)
430
	printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n"
431
endif
432
 
433
 
5 Plagman 434
# RULES
3057 helixhorne 435
 
3551 terminx 436
$(EBACKTRACEDLL): platform/Windows/src/backtrace.c
3163 hendricks2 437
	$(COMPILE_STATUS)
4076 hendricks2 438
	if $(CC) $(OURCONLYFLAGS) -O2 -shared -Wall -Wextra -static-libgcc -I$(EINC) -o $@ $^ -lbfd -liberty -limagehlp; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
2037 helixhorne 439
 
285 terminx 440
$(OBJ)/%.$o: $(SRC)/%.nasm
1102 terminx 441
	$(COMPILE_STATUS)
2520 hendricks2 442
	$(AS) $(OURASFLAGS) $< -o $@
1693 helixhorne 443
 
285 terminx 444
$(OBJ)/%.$o: $(SRC)/%.c
1102 terminx 445
	$(COMPILE_STATUS)
3122 hendricks2 446
	if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
1101 terminx 447
 
4194 helixhorne 448
#### Frama-C and related
449
 
450
.PHONY: print-compiler-options
451
print-compiler-options:
452
	@echo "$(OURCFLAGS)"
453
 
454
#frama-c-check:
455
#	frama-c -machdep x86_64 -cpp-command "gcc -C -E $(OURCFLAGS)" -no-annot -val source/anim.c
456
 
3131 helixhorne 457
#### Utilities
458
 
3163 hendricks2 459
$(OBJ)/%.$o: $(SRC)/util/%.c
460
	$(COMPILE_STATUS)
461
	if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
3131 helixhorne 462
 
3163 hendricks2 463
ivfrate$(EXESUFFIX): $(OBJ)/ivfrate.$o
464
	$(ONESTEP_STATUS)
3219 hendricks2 465
	if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(OURLIBS); then $(ONESTEP_OK); else $(ONESTEP_FAILED); fi
3163 hendricks2 466
 
3057 helixhorne 467
#### Lunatic
468
 
2650 helixhorne 469
# Create object files directly with luajit
4000 helixhorne 470
$(OBJ)/luaJIT_BC_%.$o: $(MAKEFILE_COMMON_DIR)/source/lunatic/%.lua
2650 helixhorne 471
	$(COMPILE_STATUS)
4023 helixhorne 472
	if $(LUAJIT) -bg $(LUAJIT_BCOPTS) $< $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
2650 helixhorne 473
 
4238 helixhorne 474
# Same thing for defs*.ilua which I'm too reluctant to rename now:
4000 helixhorne 475
# NOTE: The target path must match EXACTLY with that of the DEFS_BC_SIZE
476
# determination in Makefile.common, because it is embedded into the bytecode as
477
# debugging information.
478
$(OBJ)/luaJIT_BC_%.$o: $(MAKEFILE_COMMON_DIR)/source/lunatic/%.ilua
4023 helixhorne 479
	if $(LUAJIT) -bg $(LUAJIT_BCOPTS) $< $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
3517 helixhorne 480
 
2034 helixhorne 481
$(OBJ)/%.$o: $(SRC)/lunatic/%.c
482
	$(COMPILE_STATUS)
3122 hendricks2 483
	if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
2034 helixhorne 484
 
3057 helixhorne 485
# TODO: _m32
486
# List of exported symbols, OS X
2074 helixhorne 487
$(SRC)/lunatic/dynsymlist_osx: $(SRC)/lunatic/dynsymlist
488
	sed 's/[{};]//g;s/[A-Za-z_][A-Za-z_0-9]*/_&/g' $< > $@
489
 
3057 helixhorne 490
#$(SRC)/lunatic/aliases_list: $(SRC)/lunatic/dynsymlist_osx
491
#	sed 's/_\([A-Za-z_][A-Za-z_0-9]*\)/_\1 \1/g' $< > $@
2074 helixhorne 492
 
3057 helixhorne 493
# List of exported symbols, Windows
2143 helixhorne 494
$(SRC)/lunatic/eduke32.def: $(SRC)/lunatic/dynsymlist
495
	echo EXPORTS > $@
496
	sed 's/[{};]//g' $< >> $@
497
 
3248 helixhorne 498
$(SRC)/lunatic/mapster32.def: $(SRC)/lunatic/dynsymlist_m32
499
	echo EXPORTS > $@
500
	sed 's/[{};]//g' $< >> $@
501
 
3057 helixhorne 502
####
503
 
3551 terminx 504
$(OBJ)/%.$o: platform/Apple/%.m
1905 helixhorne 505
	$(COMPILE_STATUS)
3122 hendricks2 506
	if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
1905 helixhorne 507
 
3334 hendricks2 508
$(OBJ)/%.$o: $(SRC)/%.m
509
	$(COMPILE_STATUS)
510
	if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
511
 
2458 hendricks2 512
$(OBJ)/%.$o: $(SRC)/%.cc
513
	$(COMPILE_STATUS)
3163 hendricks2 514
	if $(CXX) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
2458 hendricks2 515
 
285 terminx 516
$(OBJ)/%.$o: $(SRC)/%.cpp
1102 terminx 517
	$(COMPILE_STATUS)
3163 hendricks2 518
	if $(CXX) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
1101 terminx 519
 
2458 hendricks2 520
$(OBJ)/%.$o: $(SRC)/%.cxx
521
	$(COMPILE_STATUS)
3163 hendricks2 522
	if $(CXX) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
2458 hendricks2 523
 
285 terminx 524
$(OBJ)/%.$o: $(SRC)/jmact/%.c
1102 terminx 525
	$(COMPILE_STATUS)
3122 hendricks2 526
	if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
220 terminx 527
 
285 terminx 528
$(OBJ)/%.$o: $(SRC)/misc/%.rc
1102 terminx 529
	$(COMPILE_STATUS)
1503 plagman 530
	if $(RC) -i $< -o $@ --include-dir=$(EINC) --include-dir=$(SRC) -DPOLYMER=$(POLYMER); then $(COMPILE_OK); else $(COMPILE_FAILED); fi
220 terminx 531
 
285 terminx 532
$(OBJ)/%.$o: $(RSRC)/%.c
1102 terminx 533
	$(COMPILE_STATUS)
3122 hendricks2 534
	if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
1595 helixhorne 535
 
285 terminx 536
$(OBJ)/game_banner.$o: $(RSRC)/game_banner.c
1765 plagman 537
	$(COMPILE_STATUS)
3122 hendricks2 538
	if $(COMPILER) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
1791 helixhorne 539
 
285 terminx 540
$(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c
1765 plagman 541
	$(COMPILE_STATUS)
3122 hendricks2 542
	if $(COMPILER) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
1765 plagman 543
 
285 terminx 544
$(RSRC)/game_banner.c: $(RSRC)/game.bmp
5 Plagman 545
	echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@
3137 Plagman 546
	echo "extern const GdkPixdata startbanner_pixdata;" >> $@
5 Plagman 547
	gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
285 terminx 548
$(RSRC)/editor_banner.c: $(RSRC)/build.bmp
5 Plagman 549
	echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@
3137 Plagman 550
	echo "extern const GdkPixdata startbanner_pixdata;" >> $@
5 Plagman 551
	gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
552
 
3163 hendricks2 553
# PHONIES
996 terminx 554
 
4343 hendricks2 555
clean: $(UNDO_REV)
3297 terminx 556
	-rm -f $(OBJ)/* $(EDUKE32) $(EDUKE32).memmap $(MAPSTER32) $(MAPSTER32).memmap core* && $(MAKE) -C $(JAUDIOLIBDIR) clean && $(MAKE) -C $(ENETDIR) clean
2388 helixhorne 557
ifeq ($(PLATFORM),DARWIN)
558
	-rm -rf EDuke32.app Mapster32.app
559
endif
1939 hendricks2 560
	echo -n "" > $(OBJ)/keep.me
5 Plagman 561
 
3163 hendricks2 562
cleanutils:
563
	-rm -f $(UTILS) $(UTILOBJS) $(addsuffix .memmap, $(UTILS))
564
 
565
veryclean: clean cleanutils
2041 helixhorne 566
	-rm -f $(EOBJ)/* $(RSRC)/*banner* $(EBACKTRACEDLL)
1939 hendricks2 567
	echo -n "" > $(EOBJ)/keep.me
3163 hendricks2 568
 
569
printutils:
570
	echo "$(UTILS)"
4343 hendricks2 571
 
572
rev:
573
	@echo "s_buildRev = \"r$(VC_REV)$(VC_REV_CUSTOM)\";">source/rev.h
574
 
575
rev_clean:
576
	@$(VC_CLEAN) source/rev.h