Merge back from 2.21-pre1
[fw/sdcc] / support / scripts / mega.mak
1 # A simple Makefile that attempts to weave everything together
2 # for a build.  Basically:
3 #  * Makes a temporary build directory
4 #  * Copies itself and build.mak off, hands over to the new Makefile
5 #  * Downloads the source
6 #  * Compiles the native, then win32 versions
7 #  * Takes the libs from native and hooks them into win32
8 #  * tars it all up and calls it done
9
10 BUILD_DIR = /home/michaelh/tmp/sdcc-build
11 NATIVE = linux-linux
12 CROSS = linux-mingw32
13 NATIVE_DIST = linux-glibc2
14 CROSS_DIST = win32
15
16 VER = 2.21-pre1
17
18 all: spawn
19
20 spawn:
21         mkdir -p $(BUILD_DIR)
22         cp build.mak mega.mak $(BUILD_DIR)
23         make -C $(BUILD_DIR) -f mega.mak build
24
25 build: orig native cross dist
26
27 dist:
28         cd $(NATIVE)/build; tar czf ../../sdcc-$(VER)-$(NATIVE_DIST).tar.gz sdcc
29 ifeq ($(CROSS_DIST), win32)
30         rm -f sdcc-$(VER)-$(CROSS_DIST).zip
31         cd $(CROSS)/build; zip -rlq9 ../../sdcc-$(VER)-$(CROSS_DIST).zip sdcc
32 else
33         cd $(CROSS)/build; tar czf ../../sdcc-$(VER)-$(CROSS_DIST).tar.gz sdcc
34 endif
35
36 clean:
37         rm -rf $(BUILD_DIR)
38
39 orig:
40         mkdir -p orig
41         cp build.mak orig
42         touch orig/logged_in                    # Assume already logged in
43         make -C orig -f build.mak update
44
45
46 linux-linux: orig
47         mkdir -p linux-linux
48         (cd orig; tar cf - .) | (cd linux-linux; tar xf -)
49
50 linux-mingw32: orig
51         mkdir -p linux-mingw32
52         (cd orig; tar cf - .) | (cd linux-mingw32; tar xf -)
53
54 native: $(NATIVE) dummy
55         cp build.mak $(NATIVE)
56         make -C $(NATIVE) -f build.mak COMPILE_MODE=$(NATIVE)
57
58 dummy:
59
60 # We do a first pass, ignored build on sdccconf.h as at the moment
61 # it fails while configuring the sim.
62 cross-bin: $(CROSS) dummy
63         cp build.mak $(CROSS)
64         -make -C $(CROSS) -f build.mak COMPILE_MODE=$(CROSS) sdcc/sdccconf.h
65         make -C $(CROSS) -f build.mak COMPILE_MODE=$(CROSS) sdcc-bin lcc tidy
66
67 # Binary files are compiled; now copy the built libs from the native
68 # version across
69 cross-mix:
70         mv $(CROSS)/build/sdcc/bin $(CROSS)/build/sdcc/bin.1
71         (cd $(NATIVE); tar cf - build/sdcc) | (cd $(CROSS); tar xf - )
72         rm -rf $(CROSS)/build/sdcc/bin
73         mv $(CROSS)/build/sdcc/bin.1 $(CROSS)/build/sdcc/bin
74
75 cross: cross-bin cross-mix