forked from iPodLinux-Community/podzillaz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
326 lines (287 loc) · 9.7 KB
/
Makefile
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
DESTDIR ?= /mnt/ipod
ifdef SUBDIRS
do-it: buildmod
endif
ifndef TTKDIR
ifeq ($(shell which ttk-config 2>/dev/null >/dev/null && echo yes),yes)
MYTTKCONF = ttk-config
export TTKCONF := $(MYTTKCONF)
endif
ifneq ($(wildcard ttk/ttk-config-here),)
TTKDIR = ttk
else
ifneq ($(wildcard ../ttk/ttk-config-here),)
TTKDIR = ../ttk
else
ifneq ($(wildcard ../../../libs/ttk/ttk-config-here),)
TTKDIR = ../../../libs/ttk
endif
endif
endif
endif
ifndef TTKCONF
ifndef TTKDIR
$(error Cannot find TTK. Specify TTKDIR, put it in ttk, ../ttk, ../../../libs/ttk, or install it.)
else
MYTTKCONF = $(TTKDIR)/ttk-config-here
export TTKCONF=${PWD}/$(MYTTKCONF)
endif
endif
ifdef IPOD
CC = $(CROSS)-gcc
LIBS += -Wl,-elf2flt -Wl,-whole-archive -lc `$(MYTTKCONF) --ipod --sdl --libs` ../ucdl/libuCdl.a -lintl `$(CC) -print-libgcc-file-name` -lsupc++ -Wl,-no-whole-archive -mapcs
CROSS ?= arm-uclinux-elf
else
ifeq ($(shell uname),Darwin)
EXPSYM =
INTL = -lintl
else
EXPSYM = -Wl,-E
INTL =
LIBS += -L/sw/lib
endif
LIBS += -g `$(MYTTKCONF) --x11 --sdl --libs` -L/usr/local/lib -lstdc++ -ldl -lm $(INTL) $(EXPSYM)
CC ?= cc
endif
POD ?= ../../../podfile/pod # relative to two dirs down
all-msg: all .message
.config:
@$(MAKE) -s silentdefconfig
Config.in:
@perl make-config.pl
Kconfig/conf:
@echo
@echo Building text-based configuration utility.
@$(MAKE) -sC Kconfig conf
Kconfig/mconf:
@echo
@echo Building graphical configuration utility.
@$(MAKE) -sC Kconfig mconf
config: Kconfig/conf Config.in
@echo " CONF"
@./Kconfig/conf Config.in
menuconfig: Kconfig/mconf Config.in
@echo " MCONF"
@./Kconfig/mconf Config.in
defconfig: Kconfig/conf Config.in
@echo " CONF [def]"
@./Kconfig/conf -d Config.in
oldconfig: Kconfig/conf Config.in
@echo " CONF [old]"
@./Kconfig/conf -o Config.in
silentdefconfig: Kconfig/conf Config.in
@echo " CONF [def]"
@./Kconfig/conf -d Config.in >/dev/null
# Everything in one executable
fatconfig: Kconfig/conf Config.in
@echo " CONF [fat]"
@./Kconfig/conf -y Config.in
# Everything as modules
chunkyconfig: defconfig
# No modules
slimconfig: Kconfig/conf Config.in
@echo " CONF [slim]"
@./Kconfig/conf -n Config.in
all: .config checktarget core modules contrib
@echo
@echo "Linking podzilla."
@echo " LD podzilla"
@$(CC) -o podzilla core/built-in.o $(wildcard modules/built-in.o) $(LIBS)
ifdef IPOD
# This must be AFTER the elf2flt compilation, because elf2flt deletes podzilla.elf.
@echo " LD podzilla.elf"
@$(CC) -Wl,-r -d -o podzilla.o core/built-in.o $(wildcard modules/built-in.o) $(LIBS)
@$(CROSS)-ld.real -T elf2flt.ld -Ur -o podzilla.elf podzilla.o
@echo " SYMS podzilla"
@$(CROSS)-nm podzilla.elf | ../ucdl/symadd podzilla
endif
install:
@if [ "$(DESTDIR)" = "/mnt/ipod" -a -z "$(wildcard $(DESTDIR)/bin)" ]; then echo "*** $(DESTDIR)/bin does not exist. Please verify that you have correctly specified your iPod location. Stop."; false; fi
@mkdir -p $(DESTDIR)/bin $(DESTDIR)/usr/lib
@mkdir -p $(DESTDIR)/usr/share/schemes $(DESTDIR)/usr/share/fonts
@echo "Installing to $(DESTDIR)."
@echo " INST podzilla"
@install -m 755 podzilla $(DESTDIR)/bin/podzilla
@echo " INST modules:"
@$(MAKE) install -sC modules DESTDIR=$(DESTDIR) IPOD=1
@if [ ! -d $(TTKDIR)/schemes ]; then echo "*** No Schemes directory found. Not installed." ; false; fi
@echo " INST schemes:"
@install $(TTKDIR)/schemes/* $(DESTDIR)/usr/share/schemes/
@echo " INST fonts:"
@if [ ! -d $(TTKDIR)/fonts ]; then echo "*** No Fonts directory found. Not installed." ; false; fi
@install $(TTKDIR)/fonts/* $(DESTDIR)/usr/share/fonts/
.message:
ifdef IPOD
@echo
@echo "-------------------------------------------------"
@echo "Podzilla and modules have been built. Do"
@echo " make install DESTDIR=/mnt/ipod IPOD=1"
@echo "to install it. Enjoy."
@echo "-------------------------------------------------"
else
@echo
@echo "---------------------------------------------------------------"
@echo "Podzilla and modules have been built. First, set up some stuff:"
@echo " make dev-env (assuming you have ttk in ttk, ../ttk or ../../../libs/ttk)"
@echo "Then, to run it,"
@echo " ./podzilla"
@echo "or, for a different screen size,"
@echo " ./podzilla [-g nano | -g mini | -g photo | -g video]"
@echo "Enjoy."
@echo "---------------------------------------------------------------"
endif
@touch .message
checktarget: .curtgt
@if [ -f .target ]; then cmp .curtgt .target >/dev/null || ( echo "Cleaning because of target change."; make -s clean; echo ); fi
@cp .curtgt .target
.curtgt:
ifdef IPOD
@echo "iPod" > .curtgt
else
@echo "X11" > .curtgt
endif
core:
@echo
@echo "Building core."
@make -sC core
modules:
@echo
@echo "Building modules."
@true > modules/.mods
@make -sC modules
clean:
@echo " CLEAN podzilla"
@rm -f podzilla podzilla.gdb
@echo " CLEAN config"
@make clean -sC Kconfig
@echo " CLEAN core"
@make clean -sC core
@echo " CLEAN ../ucdl"
@make clean -sC ../ucdl
@echo " CLEAN modules:"
@make clean -sC modules
@rm -f .message .target modules/.mods Config.in menu-strings.c
@rm -f podzilla.o podzilla.elf
@make clean -sC Kconfig
mrproper: clean
@rm -f .config config.h
@rm -f podzilla2.pot
dev-env:
ifndef TTKDIR
$(error Cannot find TTK. Specify TTKDIR, put it in ttk, ../ttk, ../../../libs/ttk, or install it.)
else
mkdir -p config pods xpods
-ln -sf $(TTKDIR)/fonts
-ln -sf $(TTKDIR)/schemes
-ln -s mono.cs schemes/default.cs
endif
xpods:
@echo
@echo "Building modules, stage 2."
@mkdir -p xpods
@make xpods -sC modules
ifdef IPOD
pods: xpods
@echo
@echo "Building modules, stage 3 (iPod)."
@mkdir -p pods
@for dir in `cat modules/.mods`; do ( cd xpods/$$dir; echo " POD $$dir"; $(POD) -c ../../pods/$$dir.pod * ); done
else
# Just make dummy files
pods:
@echo
@mkdir -p pods
@echo "Building modules, stage 3 (desktop)."
@for dir in `cat modules/.mods`; do echo " POD [D] $$dir"; touch pods/$$dir.pod; done
endif
ifdef SUBDIRS
buildmod:
@for dir in $(SUBDIRS); do \
make -sC $$dir -f `pwd`/module.mk PZPATH=`pwd`; done
endif
contrib:
ifdef IPOD
@make -sC ../ucdl
endif
API.pdf: API.tex
pdflatex API.tex
pdflatex API.tex
translate:
@echo " Extracting menu strings..."
@find . -type f -name '*.c' | perl xgettext-menu.pl > menu-strings.c
@echo " Extracting other strings..."
@xgettext -kN_ -k_ -o pz2.pot.tmp `find . -type f -name '*.c' -print`
@echo " Generating template file..."
@echo "# podzilla2 LANGUAGE translation" > podzilla2.pot
@echo "# Copyright (C) 2003-2006 Bernard Leach" >> podzilla2.pot
@echo "# This file is distributed under the same license as the podzilla2 package." >> podzilla2.pot
@tail -n +4 pz2.pot.tmp >> podzilla2.pot
@rm -f pz2.pot.tmp
@echo
@echo "---------------------------------------------------------------"
@echo "Translation template file is in podzilla2.pot"
@echo "If you haven't already, please read the internationalization"
@echo " documentation at http://ipodlinux.org/Internationalization"
@echo "---------------------------------------------------------------"
.PHONY: core modules clean pods xpods dev-env contrib translate .curtgt Config.in
help:
@echo ""
@echo === Useful makefile targets ===
@echo ""
@echo == general targets ==
@echo all .......... build the entire thing
@echo install ...... build and install to your ipod
@echo clean ........ remove all generated binaries
@echo dev-env ...... links ttk directories over for desktop dev
@echo ""
@echo == language ==
@echo translate .... make the translation strings files
@echo ""
@echo == module config ==
@echo defconfig .... generate a default configuration file
@echo mrproper ..... a more complete 'clean' which wipes config stuff
@echo config ....... text-based module configuration
@echo menuconfig ... curses-based module configuration
@echo ""
@echo == developer ==
@echo modulesourcedist MODULE=modulename MODVERS=r24 ... makes a source zip
@echo ""
.PHONY: help
modulesourcedist:
@if [[ "$(MODULE)" == "" ]]; then echo "make modulesourcedist MODULE=YourModuleName MODVERS=1.0"; false ; fi
@if [[ "$(MODVERS)" == "" ]]; then echo "make modulesourcedist MODULE=YourModuleName MODVERS=1.0"; false ; fi
@if [ ! -d modules/$(MODULE) ]; then echo "Module $(MODULE) does not exist." ; false; fi
@if [ ! -f modules/$(MODULE)/Makefile ]; then echo "No Makefile."; false; fi
@if [ ! -f modules/$(MODULE)/Module ]; then echo "No Module file."; false; fi
@echo -- Creating directory...
@-rm -rf $(MODULE)_$(MODVERS)_src
@mkdir -p $(MODULE)_$(MODVERS)_src/$(MODULE)
@echo -- Copying files...
@cp -r modules/$(MODULE)/* $(MODULE)_$(MODVERS)_src/$(MODULE)
@echo -- Removing extraneous files...
@-rm -rf $(MODULE)_$(MODVERS)_src/$(MODULE)/*.o
@-rm -rf $(MODULE)_$(MODVERS)_src/$(MODULE)/*.so
@-rm -rf $(MODULE)_$(MODVERS)_src/$(MODULE)/.svn
@-rm -rf $(MODULE)_$(MODVERS)_src/$(MODULE)/CVS
@-rm -rf $(MODULE)_$(MODVERS)_src/$(MODULE)/*~
@echo -- Building ZIP file...
@zip -rp $(MODULE)_$(MODVERS)_src.zip $(MODULE)_$(MODVERS)_src
@echo -n -- Cleaning up...
@-rm -rf $(MODULE)_$(MODVERS)_src
@echo ...done.
@echo
@echo Your module source archive is: $(MODULE)_$(MODVERS)_src.zip
.PHONY: moduledist