summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2008-11-20 11:27:31 +0000
committerBjörn Stenberg <bjorn@haxx.se>2008-11-20 11:27:31 +0000
commitc6b3d38a156dd624760a8eb1bb374affd43b4f2a (patch)
tree493eba929e2396d86cf4f077709aa09fe172cd35 /tools
parentf66c30346783a400a029bedcd60ab67c81c34a07 (diff)
downloadrockbox-c6b3d38a156dd624760a8eb1bb374affd43b4f2a.tar.gz
rockbox-c6b3d38a156dd624760a8eb1bb374affd43b4f2a.zip
New makefile solution: A single invocation of 'make' to build the entire tree. Fully controlled dependencies give faster and more correct recompiles.
Many #include lines adjusted to conform to the new standards. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19146 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile4
-rwxr-xr-xtools/configure183
-rw-r--r--tools/functions.make68
-rw-r--r--tools/makebmp.inc33
-rw-r--r--tools/makesubdirs.inc14
-rw-r--r--tools/root.make294
-rw-r--r--tools/tools.make40
7 files changed, 409 insertions, 227 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 0bd0209b86..569a727139 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -15,8 +15,8 @@ CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \
15 generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat database \ 15 generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat database \
16 lngdump telechips gigabeats creative hmac-sha1 mktccboot mknkboot rbspeexenc mkzenboot 16 lngdump telechips gigabeats creative hmac-sha1 mktccboot mknkboot rbspeexenc mkzenboot
17 17
18all: 18all: scramble descramble sh2d rdf2binary mkboot mktccboot mknkboot mkzenboot \
19 @echo "Run make in your build directory!" 19 convbdf codepages uclpack rbspeexenc voicefont
20 20
21scramble: scramble.o iriver.o mi4.o gigabeat.o gigabeats.o telechips.o iaudio_bl_flash.o creative.o hmac-sha1.o 21scramble: scramble.o iriver.o mi4.o gigabeat.o gigabeats.o telechips.o iaudio_bl_flash.o creative.o hmac-sha1.o
22descramble: descramble.o iriver.o gigabeat.o 22descramble: descramble.o iriver.o gigabeat.o
diff --git a/tools/configure b/tools/configure
index 433dc6683c..0f6c3bb8c0 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1325,8 +1325,6 @@ fi
1325 boottool="$rootdir/tools/scramble -tcc=crc" 1325 boottool="$rootdir/tools/scramble -tcc=crc"
1326 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 1326 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1327 bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 1327 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1328 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1329 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1330 output="rockbox.d2" 1328 output="rockbox.d2"
1331 appextra="recorder:gui" 1329 appextra="recorder:gui"
1332 plugins="yes" 1330 plugins="yes"
@@ -1414,8 +1412,6 @@ fi
1414 tool="cp " 1412 tool="cp "
1415 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 1413 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1416 bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 1414 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1417 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1418 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1419 output="rockbox.mrobe500" 1415 output="rockbox.mrobe500"
1420 appextra="recorder:gui" 1416 appextra="recorder:gui"
1421 plugins="yes" 1417 plugins="yes"
@@ -1438,8 +1434,6 @@ fi
1438 tool="$rootdir/tools/scramble -mi4v2 -model=m100 -type=RBOS" 1434 tool="$rootdir/tools/scramble -mi4v2 -model=m100 -type=RBOS"
1439 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 1435 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1440 bmp2rb_native="$rootdir/tools/bmp2rb -f 0" 1436 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1441 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1442 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1443 output="rockbox.mi4" 1437 output="rockbox.mi4"
1444 appextra="recorder:gui" 1438 appextra="recorder:gui"
1445 plugins="yes" 1439 plugins="yes"
@@ -1487,8 +1481,6 @@ fi
1487 arm926ejscc 1481 arm926ejscc
1488 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 1482 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1489 bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 1483 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1490 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1491 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1492 tool="$rootdir/tools/scramble -creative=zvm" 1484 tool="$rootdir/tools/scramble -creative=zvm"
1493 USE_ELF="yes" 1485 USE_ELF="yes"
1494 output="rockbox.zvm" 1486 output="rockbox.zvm"
@@ -1512,8 +1504,6 @@ fi
1512 arm926ejscc 1504 arm926ejscc
1513 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 1505 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1514 bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 1506 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1515 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1516 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1517 tool="$rootdir/tools/scramble -creative=zvm60 -no-ciff" 1507 tool="$rootdir/tools/scramble -creative=zvm60 -no-ciff"
1518 USE_ELF="yes" 1508 USE_ELF="yes"
1519 output="rockbox.zvm60" 1509 output="rockbox.zvm60"
@@ -1537,8 +1527,6 @@ fi
1537 arm926ejscc 1527 arm926ejscc
1538 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 1528 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1539 bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 1529 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1540 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1541 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1542 tool="$rootdir/tools/scramble -creative=zenvision -no-ciff" 1530 tool="$rootdir/tools/scramble -creative=zenvision -no-ciff"
1543 USE_ELF="yes" 1531 USE_ELF="yes"
1544 output="rockbox.zv" 1532 output="rockbox.zv"
@@ -2074,6 +2062,8 @@ fi
2074 debug="-DDEBUG" 2062 debug="-DDEBUG"
2075 simulator="yes" 2063 simulator="yes"
2076 extradefines="-DSIMULATOR" 2064 extradefines="-DSIMULATOR"
2065 archosrom=""
2066 flash=""
2077 echo "Simulator build selected" 2067 echo "Simulator build selected"
2078 ;; 2068 ;;
2079 [Aa]) 2069 [Aa])
@@ -2397,18 +2387,6 @@ sed > Makefile \
2397<<EOF 2387<<EOF
2398## Automatically generated. http://www.rockbox.org/ 2388## Automatically generated. http://www.rockbox.org/
2399 2389
2400ifndef V
2401SILENT=@
2402else
2403VERBOSEOPT=-v
2404endif
2405
2406# old 'make' versions don't have the built-in 'info' function
2407info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
2408ifeq (\$(call info),old)
2409export info=echo "\$\$(1)";
2410endif
2411
2412export ROOTDIR=@ROOTDIR@ 2390export ROOTDIR=@ROOTDIR@
2413export FIRMDIR=@FIRMDIR@ 2391export FIRMDIR=@FIRMDIR@
2414export APPSDIR=@APPSDIR@ 2392export APPSDIR=@APPSDIR@
@@ -2428,8 +2406,8 @@ export BUILDDIR=@PWD@
2428export LANGUAGE=@LANGUAGE@ 2406export LANGUAGE=@LANGUAGE@
2429export VOICELANGUAGE=@VOICELANGUAGE@ 2407export VOICELANGUAGE=@VOICELANGUAGE@
2430export MEMORYSIZE=@MEMORY@ 2408export MEMORYSIZE=@MEMORY@
2431export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR)) 2409export VERSION:=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
2432export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d') 2410export BUILDDATE:=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
2433export MKFIRMWARE=@TOOL@ 2411export MKFIRMWARE=@TOOL@
2434export BMP2RB_MONO=@BMP2RB_MONO@ 2412export BMP2RB_MONO=@BMP2RB_MONO@
2435export BMP2RB_NATIVE=@BMP2RB_NATIVE@ 2413export BMP2RB_NATIVE=@BMP2RB_NATIVE@
@@ -2469,159 +2447,8 @@ export ENC_OPTS=@ENC_OPTS@
2469export ENCODER=@ENCODER@ 2447export ENCODER=@ENCODER@
2470export USE_ELF=@USE_ELF@ 2448export USE_ELF=@USE_ELF@
2471 2449
2472# Do not print "Entering directory ..." 2450include \$(TOOLSDIR)/root.make
2473MAKEFLAGS += --no-print-directory
2474
2475.PHONY: all clean tags zip tools manual bin build info langs
2476
2477all: info
2478
2479info: build
2480 \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt
2481
2482build: tools @LANGS@
2483 @SIMUL1@
2484 @SIMUL2@
2485 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
2486 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
2487
2488bin: tools @LANGS@
2489 @SIMUL1@
2490 @SIMUL2@
2491 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
2492 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
2493
2494rocks: tools
2495 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ rocks
2496
2497veryclean: clean toolsclean
2498
2499toolsclean:
2500 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
2501
2502clean:
2503 \$(SILENT)echo Cleaning build directory
2504 \$(SILENT)rm -rf rockbox.zip rockbox.7z rockbox.tar rockbox.tar.gz \
2505 rockbox.tar.bz2 TAGS @APPS@ firmware comsim sim lang.[ch] \
2506 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
2507 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
2508 html txt rockbox-manual*.zip sysfont.h rockbox-info.txt \
2509 voicefontids *.wav *.mp3 *.voice max_language_size.h
2510
2511tools:
2512 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) AR=\$(HOSTAR) @TOOLSET@
2513
2514voicetools:
2515 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) AR=\$(HOSTAR) @VOICETOOLSET@
2516
2517tags:
2518 \$(SILENT)rm -f TAGS
2519 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
2520 \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
2521 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
2522 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
2523
2524fontzip:
2525 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
2526
2527zip: info
2528 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
2529 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
2530
2531mapzip: info
2532 \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
2533
2534fullzip: info
2535 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
2536 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
2537
25387zip: info
2539 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
2540 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.7z" -z "7za a -mx=9" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
2541
2542tar: info
2543 \$(SILENT)rm -f rockbox.tar
2544 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
2545 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.tar" -z "tar -cf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
2546
2547bzip2: tar
2548 \$(SILENT)bzip2 -f9 rockbox.tar
2549
2550gzip: tar
2551 \$(SILENT)gzip -f9 rockbox.tar
2552
2553langs: features
2554 \$(SILENT)mkdir -p \$(BUILDDIR)/apps/lang
2555 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/lang OBJDIR=\$(BUILDDIR)/apps/lang
2556
2557manual: manual-pdf
2558manual-pdf:
2559 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
2560manual-html:
2561 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
2562manual-zhtml: manual-zip
2563manual-txt:
2564 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
2565manual-ztxt:
2566 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
2567manual-zip:
2568 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
2569
2570features: tools
2571 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ features
2572
2573help:
2574 @echo "A few helpful make targets"
2575 @echo ""
2576 @echo "all - builds a full Rockbox (default), including tools"
2577 @echo "bin - builds only the Rockbox.<target name> file"
2578 @echo "rocks - builds only plugins and codecs"
2579 @echo "clean - cleans a build directory (not tools)"
2580 @echo "veryclean - cleans the build and tools directories"
2581 @echo "manual - builds a manual"
2582 @echo "manual-html - HTML manual"
2583 @echo "manual-zip - HTML manual (zipped)"
2584 @echo "manual-txt - txt manual"
2585 @echo "fullzip - creates a rockbox.zip of your build with fonts"
2586 @echo "zip - creates a rockbox.zip of your build (no fonts)"
2587 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
2588 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
2589 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
2590 @echo "fontzip - creates rockbox-fonts.zip"
2591 @echo "mapzip - creates rockbox-maps.zip with all .map files"
2592 @echo "tools - builds the tools only"
2593 @echo "voicetools - builds the voice tools only"
2594 @echo "install - installs your build (for simulator builds only, no fonts)"
2595 @echo "fullinstall - installs your build (for simulator builds only, with fonts)"
2596 2451
2597EOF 2452EOF
2598 2453
2599if [ "yes" = "$simulator" ]; then
2600
2601 cat >> Makefile <<EOF
2602
2603install:
2604 @echo "installing your build in your archos dir"
2605 \$(SILENT)for f in \`cat \$(BUILDDIR)/apps/features\`; do feat="\$\$feat:\$\$f" ; done; \\
2606 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -s -r "\$(ROOTDIR)" -f 0 \$(TARGET) \$(BINARY)
2607
2608fullinstall:
2609 @echo "installing a full setup in your archos dir"
2610 \$(SILENT)for f in \`cat \$(BUILDDIR)/apps/features\`; do feat="\$\$feat:\$\$f" ; done; \\
2611 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -s -r "\$(ROOTDIR)" -f 2 \$(TARGET) \$(BINARY)
2612EOF
2613
2614fi
2615
2616if [ "yes" = "$voice" ]; then
2617
2618 cat >> Makefile <<EOF
2619
2620voice: voicetools features
2621 \$(SILENT)for f in \`cat \$(BUILDDIR)/${apps}/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
2622 for lang in \`echo \$(VOICELANGUAGE) |sed "s/,/ /g"\`; do \$(TOOLSDIR)/voice.pl -V -l=\$\$lang -t=\$(MODELNAME)\$\$feat -i=\$(TARGET_ID) -e="\$(ENCODER)" -E="\$(ENC_OPTS)" -s=\$(TTS_ENGINE) -S="\$(TTS_OPTS)"; done \\
2623EOF
2624
2625fi
2626
2627echo "Created Makefile" 2454echo "Created Makefile"
diff --git a/tools/functions.make b/tools/functions.make
new file mode 100644
index 0000000000..bab8a8d148
--- /dev/null
+++ b/tools/functions.make
@@ -0,0 +1,68 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
8#
9
10# preprocess - run preprocessor on a file and return the result as a string
11#
12# This uses the native 'gcc' compiler and not $(CC) since we use the -imacros
13# option and older gcc compiler doesn't have that. We use one such older
14# compiler for the win32 cross-compiles on Linux.
15#
16# The weird grep -v thing in here is due to Apple's stupidities and is needed
17# to make this do right when used on Mac OS X.
18#
19# The sed line is to prepend the directory to all source files
20
21preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c -include config.h $(1) | \
22 grep -v '^\#' | \
23 sed -e 's:^.\+:$(dir $(1))&:')
24
25preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \
26 grep -v '^\#' | grep -v "^$$" > $(2))
27
28c2obj = $(subst .c,.o,$(subst .S,.o,$(subst $(ROOTDIR),$(BUILDDIR),$(1))))
29
30# calculate dependencies for a list of source files $(2) and output them
31# to a file $(1)
32
33mkdepfile = $(shell \
34 for each in $(2); do \
35 obj=`echo $$each | sed -e 's/\.[cS]/.o/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
36 $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -MT "$$obj" $$each 2>/dev/null; \
37 done | sed -e "s: lang.h: $(BUILDDIR)/lang.o:" \
38 -e "s: sysfont.h: $(BUILDDIR)/sysfont.h:" \
39 -e "s: max_language_size.h: $(BUILDDIR)/max_language_size.h:" \
40 -e "s: bitmaps/: $(BUILDDIR)/bitmaps/:g" \
41 -e "s: pluginbitmaps/: $(BUILDDIR)/pluginbitmaps/:g" \
42 -e "s: lib/: $(APPSDIR)/plugins/lib/:g" \
43 -e "s: codeclib.h: $(APPSDIR)/codecs/lib/codeclib.h:g" \
44 > $(1); )
45
46# function to create .bmp dependencies
47bmpdepfile = $(shell \
48 for each in $(2); do \
49 obj=`echo $$each | sed -e 's/\.bmp/.o/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
50 src=`echo $$each | sed -e 's/\.bmp/.c/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
51 echo $$obj: $$src; \
52 echo $$src: $$each; \
53 done \
54 >> $(1); )
55
56ifndef V
57SILENT:=@
58else
59VERBOSEOPT:=-v
60endif
61PRINTS=$(SILENT)$(call info,$(1))
62
63# old 'make' versions don't have the built-in 'info' function
64info=old$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
65ifeq ($(call info),old)
66export info=echo "$$(1)";
67endif
68
diff --git a/tools/makebmp.inc b/tools/makebmp.inc
deleted file mode 100644
index 987a21457f..0000000000
--- a/tools/makebmp.inc
+++ /dev/null
@@ -1,33 +0,0 @@
1all: $(OUTPUT)
2
3dep: $(DEPFILE)
4
5ifndef V
6SILENT=@
7endif
8PRINTS=$(SILENT)$(call info,$(1))
9
10$(OBJDIR)/%.c: %.bmp
11 $(SILENT)mkdir -p $(dir $@)
12 $(SILENT)mkdir -p $(BMPINCDIR)
13 $(call PRINTS,BMP2RB $<)$(BMP2RB) -h $(BMPINCDIR) $< > $@
14
15$(OBJDIR)/%.o: $(OBJDIR)/%.c
16 $(SILENT)mkdir -p $(dir $@)
17 $(call PRINTS,CC $(<F))$(CC) $(CFLAGS) -c $< -o $@
18
19$(DEPFILE): SOURCES
20 $(SILENT)mkdir -p $(dir $(DEPFILE))
21 $(SILENT)rm -f $(DEPFILE)
22 $(SILENT)(for each in $(SOURCES) x; do \
23 if test "x" != "$$each"; then \
24 src=`echo $$each | sed -e 's/\.bmp/.c/'`; \
25 echo $(OBJDIR)/$$src: $$each >> $(DEPFILE) ; \
26 obj=`echo $$each | sed -e 's/\.bmp/.o/'`; \
27 echo $(OBJDIR)/$$obj: $(OBJDIR)/$$src >> $(DEPFILE) ; \
28 fi; \
29 done)
30
31$(OUTPUT): $(OBJS)
32 $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
33 $(SILENT)$(RANLIB) $@
diff --git a/tools/makesubdirs.inc b/tools/makesubdirs.inc
deleted file mode 100644
index b233430f78..0000000000
--- a/tools/makesubdirs.inc
+++ /dev/null
@@ -1,14 +0,0 @@
1# -*- Makefile -*-
2
3# return the list of extra sub-directories to build in the SUBDIRS variable
4
5# This uses the native 'gcc' compiler and not $(CC) since we use the -include
6# option and older gcc compiler doesn't have that. We use one such older
7# compiler for the win32 cross-compiles on Linux.
8#
9# The weird grep -v thing in here is due to Apple's stupidities and is needed
10# to make this do right when used on Mac OS X.
11
12SUBDIRS := $(shell cat SUBDIRS | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \
13$(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - | \
14grep -v "^\#")
diff --git a/tools/root.make b/tools/root.make
new file mode 100644
index 0000000000..87937d9cd1
--- /dev/null
+++ b/tools/root.make
@@ -0,0 +1,294 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
8#
9
10include $(TOOLSDIR)/functions.make
11
12DEFINES = -DROCKBOX -DMEMORYSIZE=$(MEMORYSIZE) -DMEM=$(MEMORYSIZE) $(TARGET) \
13 -DTARGET_ID=$(TARGET_ID) -DTARGET_NAME=\"$(MODELNAME)\" \
14 -DAPPSVERSION=\"$(VERSION)\" $(BUILDDATE) \
15 $(EXTRA_DEFINES) # <-- -DSIMULATOR or not
16INCLUDES = -I$(BUILDDIR) $(TARGET_INC)
17
18CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS)
19PPCFLAGS = $(filter-out -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix
20
21TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \
22 $(TOOLSDIR)/codepages $(TOOLSDIR)/scramble $(TOOLSDIR)/bmp2rb \
23 $(TOOLSDIR)/uclpack $(TOOLSDIR)/mktccboot $(TOOLSDIR)/mkboot
24
25# list suffixes to be understood by $*
26.SUFFIXES: .rock .codec .map .elf .c .S .o .bmp .a
27
28.PHONY: all clean tags zip tools manual bin build info langs
29
30DEPFILE = $(BUILDDIR)/make.dep
31
32all: $(DEPFILE) build
33
34# Subdir makefiles. their primary purpose is to populate SRC & OTHER_SRC
35# but they also define special dependencies and compile rules
36include $(TOOLSDIR)/tools.make
37include $(FIRMDIR)/firmware.make
38include $(ROOTDIR)/apps/bitmaps/bitmaps.make
39
40ifneq (,$(findstring bootloader,$(APPSDIR)))
41 include $(APPSDIR)/bootloader.make
42else ifneq (,$(findstring bootbox,$(APPSDIR)))
43 include $(APPSDIR)/bootbox.make
44else
45 include $(APPSDIR)/apps.make
46 include $(APPSDIR)/lang/lang.make
47
48 ifdef SOFTWARECODECS
49 include $(APPSDIR)/codecs/codecs.make
50 endif
51
52 ifdef ENABLEDPLUGINS
53 include $(APPSDIR)/plugins/bitmaps/pluginbitmaps.make
54 include $(APPSDIR)/plugins/plugins.make
55 endif
56
57 ifdef SIMVER
58 include $(ROOTDIR)/uisimulator/uisimulator.make
59 endif
60endif # bootloader
61
62OBJ := $(SRC:.c=.o)
63OBJ := $(OBJ:.S=.o)
64OBJ += $(BMP:.bmp=.o)
65OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(OBJ))
66
67build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(ARCHOSROM)
68 $(SILENT)$(TOOLSDIR)/mkinfo.pl $(BUILDDIR)/rockbox-info.txt
69
70ifneq (clean,$(findstring clean,$(MAKECMDGOALS))) # don't build deps before cleaning
71$(DEPFILE) dep:
72 $(call PRINTS,Generating dependencies)
73 @echo foo > /dev/null # there must be a "real" command in the rule
74 $(call mkdepfile,$(DEPFILE),$(SRC) $(OTHER_SRC))
75 $(call bmpdepfile,$(DEPFILE),$(BMP) $(PBMP))
76endif
77
78bin: $(DEPFILE) $(TOOLS) $(BUILDDIR)/$(BINARY)
79rocks: $(DEPFILE) $(TOOLS) $(ROCKS)
80codecs: $(DEPFILE) $(TOOLS) $(CODECS)
81
82-include $(DEPFILE)
83
84veryclean: clean
85 $(SILENT)rm -rf $(TOOLS)
86
87clean:
88 $(SILENT)echo Cleaning build directory
89 $(SILENT)rm -rf rockbox.zip rockbox.7z rockbox.tar rockbox.tar.gz rockbox.tar.bz2 TAGS apps firmware comsim sim lang.[ch] manual *.pdf *.a credits.raw rockbox.ipod bitmaps pluginbitmaps UI256.bmp rockbox-full.zip html txt rockbox-manual*.zip sysfont.h rockbox-info.txt voicefontids *.wav *.mp3 *.voice max_language_size.h $(CLEANOBJS) $(LINKRAM) $(LINKROM) rockbox.elf rockbox.map rockbox.bin $(DEPFILE) rombox.elf rombox.map rombox.bin $(BINARY) $(FLASHFILE) uisimulator bootloader flash
90
91#### linking the binaries: ####
92
93.SECONDEXPANSION:
94
95ifndef SIMVER
96
97ifeq (,$(findstring bootloader,$(APPSDIR)))
98# not bootloader
99
100## target build
101RAMLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/app.lds
102LINKRAM := $(BUILDDIR)/ram.link
103ROMLDS := $(FIRMDIR)/rom.lds
104LINKROM := $(BUILDDIR)/rom.link
105
106$(LINKRAM): $(RAMLDS)
107 $(call PRINTS,PP $(@F))
108 $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
109
110$(LINKROM): $(ROMLDS)
111 $(call PRINTS,PP $(@F))
112 $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
113
114$(BUILDDIR)/rockbox.elf : $$(OBJ) $$(FIRMLIB) $$(VOICESPEEXLIB) $$(LINKRAM)
115 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Wl,--gc-sections -Os -nostdlib -o $@ $(OBJ) \
116 -L$(BUILDDIR)/firmware -lfirmware\
117 -L$(BUILDDIR)/apps/codecs $(VOICESPEEXLIB:lib%.a=-l%) \
118 -lgcc \
119 -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map
120
121$(BUILDDIR)/rombox.elf : $$(OBJ) $$(FIRMLIB) $$(VOICESPEEXLIB) $$(LINKROM)
122 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
123 $(VOICESPEEXLIB) $(FIRMLIB) -lgcc -L$(BUILDDIR)/firmware \
124 -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rockbox.map
125
126$(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf
127 $(call PRINTS,OC $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@
128
129$(BUILDDIR)/rombox.bin : $(BUILDDIR)/rombox.elf
130 $(call PRINTS,OC $(@F))$(OC) -O binary $< $@
131
132#
133# If there's a flashfile defined for this target (rockbox.ucl for Archos
134# models) Then check if the mkfirmware script fails, as then it is (likely)
135# because the image is too big and we need to create a compressed image
136# instead.
137#
138$(BUILDDIR)/$(BINARY) : $(BUILDDIR)/rockbox.bin $(FLASHFILE)
139 $(call PRINTS,SCRAMBLE $(notdir $@))($(MKFIRMWARE) $< $@; \
140 stat=$$?; \
141 if test -n "$(FLASHFILE)"; then \
142 if test "$$stat" -ne 0; then \
143 echo "Image too big, making a compressed version!"; \
144 $(MAKE) -C $(FIRMDIR)/decompressor OBJDIR=$(BUILDDIR)/firmware/decompressor; \
145 $(MKFIRMWARE) $(BUILDDIR)/firmware/decompressor/compressed.bin $@; \
146 fi \
147 fi )
148
149# archos
150$(BUILDDIR)/rockbox.ucl: $(BUILDDIR)/rockbox.bin
151 $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --best --2e -b1048576 $< $@ >/dev/null 2>&1
152
153MAXINFILE = $(BUILDDIR)/temp.txt
154MAXOUTFILE = $(BUILDDIR)/romstart.txt
155
156$(BUILDDIR)/rombox.ucl: $(BUILDDIR)/rombox.bin $(MAXOUTFILE)
157 $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --none $< $@ >/dev/null; \
158 perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $<; \
159 if test $$? -ne 0; then \
160 echo "removing UCL file again, making it a fake one"; \
161 echo "fake" > $@; \
162 fi
163
164$(MAXOUTFILE):
165 $(call PRINTS,Creating $(@F))
166 $(SILENT)$(shell echo '#include "config.h"' > $(MAXINFILE))
167 $(SILENT)$(shell echo "ROM_START" >> $(MAXINFILE))
168 $(call preprocess2file,$(MAXINFILE),$(MAXOUTFILE))
169 $(SILENT)rm $(MAXINFILE)
170
171# iriver
172$(BUILDDIR)/rombox.iriver: $(BUILDDIR)/rombox.bin
173 $(call PRINTS,Build ROM file)$(MKFIRMWARE) $< $@
174
175endif # !bootloader
176endif # !SIMVER
177
178
179voicetools:
180 $(SILENT)$(MAKE) -C $(TOOLSDIR) CC=$(HOSTCC) AR=$(HOSTAR) rbspeexenc voicefont wavtrim
181
182tags:
183 $(SILENT)rm -f TAGS
184 $(SILENT)etags -o $(BUILDDIR)/TAGS $(filter-out %.o,$(SRC) $(OTHER_SRC))
185
186fontzip:
187 $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)\" -r "$(ROOTDIR)" -f 1 -o rockbox-fonts.zip $(TARGET) $(BINARY)
188
189zip:
190 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done ; \
191 $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" $(TARGET) $(BINARY)
192
193mapzip:
194 $(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
195
196fullzip:
197 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
198 $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" -f 2 -o rockbox-full.zip $(TARGET) $(BINARY)
199
2007zip:
201 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
202 $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -o "rockbox.7z" -z "7za a -mx=9" -r "$(ROOTDIR)" $(TARGET) $(BINARY)
203
204tar:
205 $(SILENT)rm -f rockbox.tar
206 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
207 $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -o "rockbox.tar" -z "tar -cf" -r "$(ROOTDIR)" $(TARGET) $(BINARY)
208
209bzip2: tar
210 $(SILENT)bzip2 -f9 rockbox.tar
211
212gzip: tar
213 $(SILENT)gzip -f9 rockbox.tar
214
215manual manual-pdf:
216 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-pdf
217manual-html:
218 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-html
219manual-zhtml: manual-zip
220manual-txt:
221 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-txt
222manual-ztxt:
223 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-txt-zip
224manual-zip:
225 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-zip
226
227ifdef TTS_ENGINE
228
229voice: voicetools features
230 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done ; \
231 for lang in `echo $(VOICELANGUAGE) |sed "s/,/ /g"`; do $(TOOLSDIR)/voice.pl -V -l=$$lang -t=$(MODELNAME)$$feat -i=$(TARGET_ID) -e="$(ENCODER)" -E="$(ENC_OPTS)" -s=$(TTS_ENGINE) -S="$(TTS_OPTS)"; done \
232
233endif
234
235ifdef SIMVER
236
237install:
238 @echo "Installing your build in your archos dir"
239 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
240 $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -s -r "$(ROOTDIR)" -f 0 $(TARGET) $(BINARY)
241
242fullinstall:
243 @echo "Installing a full setup in your archos dir"
244 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
245 $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -s -r "$(ROOTDIR)" -f 2 $(TARGET) $(BINARY)
246
247endif
248
249help:
250 @echo "A few helpful make targets"
251 @echo ""
252 @echo "all - builds a full Rockbox (default), including tools"
253 @echo "bin - builds only the Rockbox.<target name> file"
254 @echo "rocks - builds only plugins"
255 @echo "codecs - builds only codecs"
256 @echo "dep - regenerates make dependency database"
257 @echo "clean - cleans a build directory (not tools)"
258 @echo "veryclean - cleans the build and tools directories"
259 @echo "manual - builds a manual (pdf)"
260 @echo "manual-html - HTML manual"
261 @echo "manual-zip - HTML manual (zipped)"
262 @echo "manual-txt - txt manual"
263 @echo "fullzip - creates a rockbox.zip of your build with fonts"
264 @echo "zip - creates a rockbox.zip of your build (no fonts)"
265 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
266 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
267 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
268 @echo "fontzip - creates rockbox-fonts.zip"
269 @echo "mapzip - creates rockbox-maps.zip with all .map files"
270 @echo "tools - builds the tools only"
271 @echo "voice - creates the voice clips (voice builds only)"
272 @echo "voicetools - builds the voice tools only"
273 @echo "install - installs your build (for simulator builds only, no fonts)"
274 @echo "fullinstall - installs your build (for simulator builds only, with fonts)"
275
276### general compile rules:
277
278# when source and object are in different locations (normal):
279$(BUILDDIR)/%.o: $(ROOTDIR)/%.c
280 $(SILENT)mkdir -p $(dir $@)
281 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
282
283$(BUILDDIR)/%.o: $(ROOTDIR)/%.S
284 $(SILENT)mkdir -p $(dir $@)
285 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
286
287# when source and object are both in BUILDDIR (generated code):
288%.o: %.c
289 $(SILENT)mkdir -p $(dir $@)
290 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
291
292%.o: %.S
293 $(SILENT)mkdir -p $(dir $@)
294 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
diff --git a/tools/tools.make b/tools/tools.make
new file mode 100644
index 0000000000..48717c1220
--- /dev/null
+++ b/tools/tools.make
@@ -0,0 +1,40 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
8#
9
10TOOLSCFLAGS := -O -g -W -Wall -Wshadow -pedantic -I$(ROOTDIR)/tools
11
12$(TOOLSDIR)/scramble: $(TOOLSDIR)/scramble.c $(TOOLSDIR)/iriver.c \
13 $(TOOLSDIR)/mi4.c $(TOOLSDIR)/gigabeat.c \
14 $(TOOLSDIR)/gigabeats.c $(TOOLSDIR)/telechips.c \
15 $(TOOLSDIR)/iaudio_bl_flash.c \
16 $(TOOLSDIR)/creative.c $(TOOLSDIR)/hmac-sha1.c
17$(TOOLSDIR)/rdf2binary: $(TOOLSDIR)/rdf2binary.c
18$(TOOLSDIR)/convbdf: $(TOOLSDIR)/convbdf.c
19$(TOOLSDIR)/codepages: $(TOOLSDIR)/codepages.c $(TOOLSDIR)/codepage_tables.c
20$(TOOLSDIR)/mkboot: $(TOOLSDIR)/mkboot.c
21$(TOOLSDIR)/mktccboot: $(TOOLSDIR)/mktccboot.c $(TOOLSDIR)/telechips.c
22$(TOOLSDIR)/wavtrim: $(TOOLSDIR)/wavtrim.c
23$(TOOLSDIR)/voicefont: $(TOOLSDIR)/voicefont.c
24
25$(TOOLSDIR)/iaudio_bl_flash.c $(TOOLSDIR)/iaudio_bl_flash.h: $(TOOLSDIR)/iaudio_bl_flash.bmp $(TOOLSDIR)/bmp2rb
26 $(call PRINTS,BMP2RB $(@F))
27 $(SILENT)$(TOOLSDIR)/bmp2rb -f 7 -h $(TOOLSDIR) $< >$(TOOLSDIR)/iaudio_bl_flash.c
28
29$(TOOLSDIR)/bmp2rb: $(TOOLSDIR)/bmp2rb.c
30 $(call PRINTS,CC $(@F))
31 $(SILENT)$(HOSTCC) -DAPPLICATION_NAME=\"$@\" $(TOOLSCFLAGS) $+ -o $@
32
33$(TOOLSDIR)/uclpack: $(TOOLSDIR)/ucl/uclpack.c $(wildcard $(TOOLSDIR)/ucl/src/*.c)
34 $(call PRINTS,CC $(@F))$(HOSTCC) $(TOOLSCFLAGS) -I$(TOOLSDIR)/ucl \
35 -I$(TOOLSDIR)/ucl/include -o $@ $^
36
37# implicit rule for simple tools
38$(TOOLSDIR)/%: $(TOOLSDIR)/%.c
39 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$@))
40 $(SILENT)$(HOSTCC) $(TOOLSCFLAGS) -o $@ $^