aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Makefile.in
blob: 1529c0020a7180a6395112b1d403a0936d74deb4 (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
##
# Makefile for @PACKAGE_STRING@
# @configure_input@
##

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

usdxrootdir = ../..

INSTALL_PATH_SUFFIX = @suffix@
INSTALL_datadir = $(datarootdir)/$(INSTALL_PATH_SUFFIX)

# recursive dir creation tool
MKDIR_P = @MKDIR_P@
# install tool
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
# calls "ln -s"
LN_S = @LN_S@

LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

# Package configuration
USDX_PACKAGE_NAME = @PACKAGE_NAME@
# should be $(USDX_PACKAGE_NAME) instead
USDX_PREFIX = UltraStar
USDX_VERSION = @PACKAGE_VERSION@
USDX_TARNAME = @PACKAGE_TARNAME@

USDX_TOOLS_DIR = $(usdxrootdir)/Tools

# file-type suffix of executables (e.g. ".exe" in windows)
EXE_SUFFIX = @EXEEXT@

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

# lazarus defines
LAZARUS_DIR = @LAZARUS_DIR@
LCL_WIDGET_TYPE = @LCL_WIDGET_TYPE@
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

# 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)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM)/$(LCL_WIDGET_TYPE) \
    $(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-SDL/SDL/Pas

# Defines
PDEFINES  = -dLCL -dLCL$(LCL_WIDGET_TYPE)

# FPC flags

# The user can overwrite the default flags with
#   make PFLAGS="myflags"
PFLAGS = -S2gi -vB
# the user's flags (specified with configure) must be the last in
# the list to overwrite the defaults (e.g.with the - option: -Xs-).
PFLAGS += @PFLAGS@

PFLAGS_DEBUG   = @PFLAGS_DEBUG@
PFLAGS_RELEASE = @PFLAGS_RELEASE@

# The user can specify additional flags with
#   make PFLAGS_EXTRA="myflags"
PFLAGS_EXTRA =
PFLAGS += $(PFLAGS_EXTRA)

# lpr project file used as input
USDX_SRC = $(USDX_PREFIX)$(PROJ_SUFFIX)
# name of executable
USDX_BIN_NAME = $(USDX_PREFIX)$(EXE_SUFFIX)
USDX_BIN = $(usdxrootdir)/$(USDX_BIN_NAME)

.PHONY: all resources ultrastardx-app install install-dev install-release install-data install-data-recursive install-exec uninstall uninstall-dev uninstall-release uninstall-data uninstall-exec clean distclean clean_obj clean_res fetch-sounds dist debian-package

all: resources ultrastardx-app

resources: $(USDX_PREFIX).lrs

ultrastardx-app: $(USDX_BIN)

# Clean and rebuild everything because FPC caches some old files
# (it uses an .inc-files cache for example).
# As a result FPC misses some changes if it is called without cleaning
# up first (very annoying while debugging).
$(USDX_BIN): clean_obj
#	$(MAKE) clean_obj
	mkdir -p $(PCUNIT_DIR)
	$(PPC) $(PFLAGS) $(PDEFINES) $(PLIBS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(USDX_SRC)

install: install-@install_type@
# depends on $(USDX_BIN)

uninstall: uninstall-@install_type@


# local development build

install-dev:
	@if [ ! -d "$(usdxrootdir)/Visuals" ]; then \
	  echo "Copying visualizer data to $(usdxrootdir)/Visuals ..."; \
	  cp -r "$(usdxrootdir)/InstallerDependencies/Visuals" "$(usdxrootdir)"; \
	fi
	@if [ ! -f "$(usdxrootdir)/Sounds/Common start.mp3" ]; then \
	  echo ""; \
	  echo "# The sound-files from Sound-directory of the 1.0.1-branch are required."; \
	  echo "# Copy them yourself to \"$(usdxrootdir)/Sounds\""; \
	  echo "# or if you are connected to the web try:"; \
	  echo "#  make fetch-sounds"; \
	fi

fetch-sounds:
	svn co https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/branches/1.0.1/Sounds tmp-sounds
	mv tmp-sounds/*.mp3 $(usdxrootdir)/Sounds
	rm -rf tmp-sounds

uninstall-dev:
	rm -f $(USDX_BIN)



# global release build

install-release: install-data install-exec

install-data:
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Themes RECURSIVE_DST_DIR=$(INSTALL_datadir)/Themes install-data-recursive
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Sounds RECURSIVE_DST_DIR=$(INSTALL_datadir)/Sounds install-data-recursive
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Languages RECURSIVE_DST_DIR=$(INSTALL_datadir)/Languages install-data-recursive
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Skins RECURSIVE_DST_DIR=$(INSTALL_datadir)/Skins install-data-recursive
	$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/InstallerDependencies/Visuals RECURSIVE_DST_DIR=$(INSTALL_datadir)/Visuals install-data-recursive

install-data-recursive:
	$(MKDIR_P) $(RECURSIVE_DST_DIR)
	@for file in $(RECURSIVE_SRC_DIR)/*; do \
	  if test -f "$$file"; then \
	    $(INSTALL_DATA) "$$file" $(RECURSIVE_DST_DIR); \
	  fi; \
	  if test -d "$$file"; then \
	    subdir="$$file"; \
	    subdirname=`basename "$$subdir"`; \
	    $(MAKE) RECURSIVE_SRC_DIR="$$subdir" RECURSIVE_DST_DIR="$(RECURSIVE_DST_DIR)/$$subdirname" install-data-recursive; \
	  fi; \
	done

install-exec:
	$(MKDIR_P) $(bindir)
	$(INSTALL) $(USDX_BIN) $(bindir)

uninstall-release: uninstall-data uninstall-exec

uninstall-data:
# TODO: delete the directories created at the first execution of usdx too (like Screenshots/Playlists)
	rm -rf $(INSTALL_datadir)/Themes
	rm -rf $(INSTALL_datadir)/Sounds
	rm -rf $(INSTALL_datadir)/Languages
	rm -rf $(INSTALL_datadir)/Skins
	rm -rf $(INSTALL_datadir)/Visuals
	rmdir $(INSTALL_datadir)

uninstall-exec:
	rm -f $(bindir)/$(USDX_BIN_NAME)

disttmpdir = ./distdir

dist:
# TODO: this needs some work
#	$(MKDIR_P) $(disttmpdir)
#	acm $(usdxrootdir) $(disttmpdir)
#	$(MAKE) -C $(disttmpdir)/Game/Code distclean 
#	tar cvzf $(USDX_TARNAME)-$(USDX_VERSION).tar.gz $(usdxrootdir)
	@echo "Comming soon"


debpkgoutdir = $(usdxrootdir)/packages
debpkgtmpdir = $(debpkgoutdir)/deb-package
# should be $(USDX_PACKAGE_NAME) instead
debpkgprefix = UltraStarDeluxe
debpkgname = $(debpkgprefix)_$(USDX_VERSION)_$(PPROCESSOR).deb

debian-package: $(debpkgname)

$(debpkgname): $(USDX_BIN)
	rm -rf $(debpkgtmpdir)
	rm -rf $(debpkgoutdir)

	$(MKDIR_P) $(debpkgoutdir)
	$(MKDIR_P) $(debpkgtmpdir)/DEBIAN

	$(MAKE) prefix=$(debpkgtmpdir)/$(prefix) install

	$(INSTALL_DATA) $(debpkgprefix).control $(debpkgtmpdir)/DEBIAN/control

	dpkg-deb --build $(debpkgtmpdir)
	mv $(debpkgtmpdir)/../deb-package.deb $(debpkgoutdir)/$(debpkgname)

#	rm -rf $(debpkgtmpdir)

clean: clean_obj

distclean: clean clean_res
	find . -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f
	find . -name "*~" -name "*.bak" -o -name "*.orig" -o -name "*.dcu" | xargs rm -f
	find . -name "__history" | xargs rm -r -f
	rm -f $(USDX_PREFIX).res $(USDX_PREFIX).identcache
	rm -f config.inc config.log config.status configure
	rm -f Makefile
	rm -f aclocal.m4 
	rm -rf autom4te.cache

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

clean_res:
	rm -f $(USDX_PREFIX).lrs

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

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

configure: configure.ac config.inc.in aclocal.m4
	autoconf

aclocal.m4: m4/*
	aclocal -I m4

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

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