aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/Makefile.in
blob: efa2e5116a22fc0f0808539df622d700eb905e4e (plain) (blame)
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
#################################################
# @PACKAGE_STRING@
# @configure_input@
#################################################

@SET_MAKE@
SHELL = /bin/sh

#################################################
# Standard definitions
#################################################

top_srcdir ?= @top_srcdir@
srcdir     ?= @srcdir@

#################################################
# Tools
#################################################

RM ?= rm -f

#################################################
# USDX Paths
#################################################

USDX_SRC_DIR   := $(top_srcdir)/src
USDX_BUILD_DIR := $(top_srcdir)/build
USDX_LIB_DIR   := $(USDX_SRC_DIR)/lib

#################################################
# FPC config
#################################################

# Free Pascal compiler binary
PPC := @PPC@
# FPC target platform and processor
PPLATFORM  := @FPC_PLATFORM@
PPROCESSOR := @FPC_PROCESSOR@

# Directories added to the unit path
PUNIT_FLAGS := -FE../game/plugins -Fu../build/fpc-$(PPROCESSOR)-$(PPLATFORM)

# Directory where compiled units (.ppu, .o and library files) are stored
PCUNIT_DIR   := $(USDX_BUILD_DIR)/fpc-$(PPROCESSOR)-$(PPLATFORM)
PCUNIT_FLAGS := -FU$(PCUNIT_DIR)

# Directories added to the includes path
PINC_FLAGS := -Fi$(USDX_LIB_DIR)/JEDI-SDL/SDL/Pas

# Flags for the treatment of a linker issue with SDL.
# Symbol _SDK_main is undefined
FPC_PLATFORM = @FPC_PLATFORM@
PFLAGS_SDL :=
ifeq ($(FPC_PLATFORM), darwin)
PFLAGS_SDL += -k"-U _SDL_main"
endif

##
# PFLAGS
##

# Defined on debug mode
ENABLE_DEBUG := @ENABLE_DEBUG@

# Note: 
#   - PFLAGS/PFLAGS_* defaults to $(PFLAGS_XYZ_DEFAULT) if not set by the user
#   - if PFLAGS is defined, PFLAGS_* will be ignored on "make all"
PFLAGS         ?= @PFLAGS@
PFLAGS_BASE    ?= @PFLAGS_BASE@
PFLAGS_DEBUG   ?= @PFLAGS_DEBUG@
PFLAGS_RELEASE ?= @PFLAGS_RELEASE@

# Do not overwrite, just add extra flags
PFLAGS_EXTRA   += @PFLAGS_EXTRA@

# Default PFLAGS, used if PFLAGS/PFLAGS_* was not set by the user 
# - Do not use -dDEBUG because it will enable unwanted features
# - Do not strip executable (-Xs, set by fpc.cfg) to be GNU make conformant
# - Use DEBUG_MODE instead of DEBUG to avoid enabling the fpc.cfg DEBUG preset
# - The flag -vB appends the full path to filenames
# - Note that fpc.cfg already defines -vinw, so add -v0 first
# - The stack check (-Ct) might not work with enabled threading
# - Do we need -Coi?
PFLAGS_BASE_DEFAULT    := -Si -Sg- -Sc- -v0Binwe
PFLAGS_DEBUG_DEFAULT   := -Xs- -g -gl -dDEBUG_MODE
PFLAGS_RELEASE_DEFAULT := -Xs- -O2
PFLAGS_EXTRA_DEFAULT   :=

# Debug/Release mode flags
# Note that flags will overwrite previously specified flags,
# e.g. "-vinwe -vi-" is the same as "-vnwe"
PFLAGS_DEBUG_ALL   := $(PFLAGS_BASE) $(PFLAGS_DEBUG) $(PFLAGS_EXTRA)
PFLAGS_RELEASE_ALL := $(PFLAGS_BASE) $(PFLAGS_RELEASE) $(PFLAGS_EXTRA)

# Choose default PFLAGS, depending on debug mode.
# Only used if PFLAGS was not set by the user.
ifdef ENABLE_DEBUG
PFLAGS_DEFAULT := $(PFLAGS_DEBUG_ALL)
else
PFLAGS_DEFAULT := $(PFLAGS_RELEASE_ALL)
endif

PFLAGS_ALL = $(PFLAGS) $(PDEFINES) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS)

.PHONY: all
all: SDK 5000Points Blind Dont_Get_Worse Duell Team_Duell

.PHONY: SDK
SDK: clean-SDK
	$(PPC) $(strip $(PFLAGS_ALL)) SDK/ModiSDK.pas
	$(PPC) $(strip $(PFLAGS_ALL)) SDK/USDXStrUtils.pas

.PHONY: 5000Points
5000Points: SDK clean-5000Points
	$(PPC) $(strip $(PFLAGS_ALL)) 5000Points/Until5000.dpr

.PHONY: Blind
Blind: SDK clean-Blind
	$(PPC) $(strip $(PFLAGS_ALL)) Blind/Blind.dpr

.PHONY: Duell
Duell: SDK clean-Duell
	$(PPC) $(strip $(PFLAGS_ALL)) Duell/Duell.dpr

.PHONY: Team_Duell
Team_Duell: SDK clean-Team_Duell
	$(PPC) $(PFLAGS_SDL) $(strip $(PFLAGS_ALL)) Team_Duell/TeamDuell.dpr

.PHONY: Dont_Get_Worse
Dont_Get_Worse: SDK clean-Dont_Get_Worse
	$(PPC) $(PFLAGS_SDL) $(strip $(PFLAGS_ALL)) Don\'t_Get_Worse/Hold_The_Line.dpr

.PHONY: clean-plugins
clean-plugins: clean-SDK clean-5000Points clean-Blind clean-Dont_Get_Worse clean-Duell clean-Team_Duell

.PHONY: clean-SDK
clean-SDK:
	$(RM) $(PCUNIT_DIR)/ModiSDK.o $(PCUNIT_DIR)/ModiSDK.ppu
	$(RM) $(PCUNIT_DIR)/USDXStrUtils.o $(PCUNIT_DIR)/USDXStrUtils.ppu

.PHONY: clean-5000Points
clean-5000Points:
	$(RM) $(PCUNIT_DIR)/Until5000.o $(PCUNIT_DIR)/libUntil5000.*

.PHONY: clean-Blind
clean-Blind:
	$(RM) $(PCUNIT_DIR)/Blind.o $(PCUNIT_DIR)/libBlind.*

.PHONY: clean-Duell
clean-Duell:
	$(RM) $(PCUNIT_DIR)/Duell.o $(PCUNIT_DIR)/libDuell.*

.PHONY: clean-Team_Duell
clean-Team_Duell:
	$(RM) $(PCUNIT_DIR)/TeamDuell.o $(PCUNIT_DIR)/libTeamDuell.*

.PHONY: clean-Dont_Get_Worse
clean-Dont_Get_Worse:
	$(RM) $(PCUNIT_DIR)/Hold_The_Line.o $(PCUNIT_DIR)/libHold_The_Line.*