aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Makefile.in
blob: b702f8d6d4e3422a2033fede52f8c672eefe1c42 (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
##
# Makefile for @PACKAGE_NAME@ @PACKAGE_VERSION@ 
# @PACKAGE_BUGREPORT@
##

# general definitions
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
infodir = @infodir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
datarootdir = @datarootdir@

# install tool
INSTALL = @INSTALL@
# calls "ln -s"
LN_S = @LN_S@

USDX_PREFIX = UltraStar
USDX_TOOLS_DIR = ../../Tools

EXE_SUFFIX = @EXEEXT@

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

# lazarus defines
LAZARUS_DIR = @LAZARUS_DIR@
PROJ_SUFFIX = .lpr

# RC to LRS resource compiler
RESCOMPILER_NAME = USDXResCompiler
RESCOMPILER_BIN = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(EXE_SUFFIX)
RESCOMPILER_SRC = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(PROJ_SUFFIX)
RESCOMPILER_PFLAGS = -dRELEASE

RES_SUFFIX = .lrs

# Directories added to the unit path
PUNIT_TOKEN = -Fu
PUNIT_FLAGS = $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM) \
              $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/images/lib/$(PPROCESSOR)-$(PPLATFORM) \
              $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/jpeg \
              $(PUNIT_TOKEN).

# Directory where compiled units (.ppu and .o files) are stored
PCUNIT_TOKEN = -FU
PCUNIT_DIR = ./build/$(PPLATFORM)/lazarus
PCUNIT_FLAGS = $(PCUNIT_TOKEN)$(PCUNIT_DIR)

# Directories added to the includes path
PINC_TOKEN = -Fi
PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDLv1.0/SDL/Pas

# Defines
PDEFINES  = -dLCL

# Misc fpc options
PCOMPAT_FLAGS    = -S2dgi
#PCOMPAT_FLAGS  += -Mdelphi
PVERBOSE_FLAGS   = -vew -l
#PDEBUG_FLAGS     = -g -gl
#PDEBUG_FLAGS     = -dDEBUG
#POTHER_FLAGS = -Crtoi
#POPTIMIZE_FLAGS_FPC204 = -OG2p3 
#POPTIMIZE_FLAGS_FPC220 = -O2p"NAME"
#POPTIMIZE_FLAGS = -dRELEASE 
#POPTIMIZE_FLAGS = -Xs
PFLAGS += $(PCOMPAT_FLAGS) \
          $(PVERBOSE_FLAGS) \
	  $(PDEFINES) 

# lpr project file used as input
USDX_SRC = $(USDX_PREFIX)$(PROJ_SUFFIX)
# name of executable
USDX_BIN = $(USDX_PREFIX)$(EXE_SUFFIX)
# name of resource
USDX_RES = $(USDX_PREFIX)$(RES_SUFFIX)

.PHONY: all resources ultrastar install uninstall clean distclean clean_obj clean_res

all: resources ultrastar

resources: $(USDX_RES)

# we need to rebuild everything, fpc does some sort of caching of old files,
# so we have to delete all the old stuff first
ultrastar: clean_obj
	mkdir -p $(PCUNIT_DIR)
	$(PPC) $(PFLAGS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$(USDX_BIN) $(USDX_SRC)

install: all
#	$()/mkinstalldirs $(bindir)
#	$()/mkinstalldirs $(libdir)
#	$()/mkinstalldirs $(infodir)
	mv $(OUTPUT) ../..
#	$(INSTALL) $(USDX_BIN) $(bindir)/$(USDX_BIN)

uninstall:
#	rm -f ...
	echo "Comming soon!"

clean: clean_obj clean_res

distclean: clean
	find . -name "*.o" -o -name "*.ppu" -o -name "*.rst" | xargs rm -f
	find . -name "*.bak" -o -name "*.orig" -o -name "*.dcu" | xargs rm -f
	find . -name "__history" | xargs rm -r -f
	rm -f $(OUTPUT).cfg $(OUTPUT).res $(OUTPUT).identcache
	rm -f config.inc config.log config.status configure

clean_obj:
	find "$(PCUNIT_DIR)" -name "*.o" -o -name "*.ppu" -o -name "*.rst" | xargs rm -f
	rm -f $(OUTPUT)

clean_res:
	rm -f $(USDX_RES) link.res

$(USDX_RES): $(RESCOMPILER_BIN) $(USDX_PREFIX).rc
	$(RESCOMPILER_BIN) $(USDX_PREFIX).rc

$(RESCOMPILER_BIN): $(RESCOMPILER_SRC)
	$(PPC) $(RESCOMPILER_PFLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(RESCOMPILER_SRC)

configure: configure.ac aclocal.m4
	autoconf

aclocal.m4: m4/*
	aclocal -I m4

Makefile: Makefile.in config.status
	./config.status

config.status: configure
	./config.status --recheck