Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / support / scripts / build.mak
blobd4f0477015f680a854d459abfc40b6bbaee80db7
1 # Makefile to get and build all the parts of GBDK
3 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
4 else if [ -x /bin/bash ]; then echo /bin/bash; \
5 else echo sh; fi ; fi)
7 TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
9 BUILD = $(TOPDIR)/build/sdcc
10 SDCCLIB = $(BUILD)
11 CVSFLAGS = -z5
12 CVS = cvs
13 SVNFLAGS =
14 SVN = svn
15 DIR = .
16 VER = 2.2.1
17 # Used as a branch name.
18 SHORTVER = 221
20 # Options:
21 # linux-linux Building on Linux, targeting Linux
22 # linux-ming32 Building on Linux, targeting mingw32 based win32
23 # cygwin-mingw32 Building via cygwin on win32, targeting mingw32
25 COMPILE_MODE = linux-mingw32
26 SDCC_OR_GBDK = sdcc
28 ROOT_GBDK = :pserver:anonymous@cvs.gbdk.sourceforge.net:/cvsroot/gbdk
29 ROOT_SDCC = https://sdcc.svn.sourceforge.net/svnroot/sdcc
31 ifeq ($(COMPILE_MODE),linux-linux)
32 # For Linux
33 SE =
34 E =
35 SDCC_ROOT = /usr/lib/$(SDCC_OR_GBDK)
36 endif
38 ifeq ($(COMPILE_MODE),linux-mingw32)
39 # For mingw32 hosted on Linux
40 # Tools name prefix
41 TNP = i386-mingw32-
42 # Source extension - what the gcc generated files have appended
43 SE =
44 # Dest extenstion - what extension we want them to have.
45 E = .exe
46 SDCC_ROOT = /$(SDCC_OR_GBDK)
47 # Set to cross to bypass the detection
48 CROSS_LIBGC = 1
49 endif
51 ifeq ($(COMPILE_MODE),cygwin-mingw32)
52 # For mingw32 on win32
53 # Source extension - what the gcc generated files have appended
54 SE = .exe
55 # Dest extenstion - what extension we want them to have.
56 SDCC_ROOT = /$(SDCC_OR_GBDK)
57 endif
59 all: logged_in dist
61 clean:
62 for i in sdcc gbdk-lib gbdk-support/lcc; do make -C $$i clean; done
63 rm -f *~
64 rm -rf $(BUILD) gbdk-lib gbdk-support sdcc logged_in
66 update: logged_in
67 cd $(DIR); svn $(SVNFLAGS) co $(ROOT_SDCC)/branches/sdcc-$(SHORTVER)/sdcc sdcc
68 cd $(DIR); cvs $(CVSFLAGS) -d$(ROOT_GBDK) co -r sdcc-$(SHORTVER) gbdk-lib
69 cd $(DIR); cvs $(CVSFLAGS) -d$(ROOT_GBDK) co -r sdcc-$(SHORTVER) gbdk-support
71 _sdcc: sdcc-bin sdcc-misc sdcc-lib sdcc-doc
73 tidy:
74 find $(BUILD) -name "CVS" -exec rm -rf \;
75 find $(BUILD) -name ".svn" -exec rm -rf \;
76 find $(BUILD)/lib -name "*.asm" -exec rm -rf \;
77 -$(TNP)strip $(BUILD)/bin/*
79 sdcc-bin: sdcc/sdccconf.h
80 make -C sdcc sdcc-bin CROSS_LIBGC=$(CROSS_LIBGC)
81 mkdir -p $(BUILD)/bin
82 for i in \
83 sdcc sdcpp link-z80 as-z80 aslink asx8051; \
84 do cp sdcc/bin/$$i$(SE) $(BUILD)/bin/$$i$(E); done
86 sdcc-misc: sdcc/sdccconf.h
87 make -C sdcc sdcc-misc CROSS_LIBGC=$(CROSS_LIBGC)
88 mkdir -p $(BUILD)/bin
89 for i in \
90 sdcdb; \
91 do cp sdcc/bin/$$i$(SE) $(BUILD)/bin/$$i$(E); done
92 cp sdcc/sim/ucsim/s51.src/s51$(E) $(BUILD)/bin
93 cp sdcc/sim/ucsim/z80.src/sz80$(E) $(BUILD)/bin
94 cp sdcc/sim/ucsim/avr.src/savr$(E) $(BUILD)/bin
95 cp sdcc/debugger/mcs51/*.el $(BUILD)/bin
97 sdcc-doc:
98 (cd sdcc; tar cf - doc) | (cd $(BUILD); tar xf -)
99 cp sdcc/README sdcc/COPYING $(BUILD)
100 mkdir -p $(BUILD)/sim
101 for i in COPYING INSTALL README TODO; \
102 do cp sdcc/sim/ucsim/$$i $(BUILD)/sim; done
103 (cd sdcc/sim/ucsim; tar cf - doc) | (cd $(BUILD)/sim; tar xf -)
105 sdcc-lib: sdcc-lib-z80 sdcc-lib-gen
106 mkdir -p $(BUILD)/lib
107 (cd sdcc/device/lib; tar cf - small large) | (cd $(BUILD)/lib; tar xf -)
108 (cd sdcc/device; tar cf - examples include) | (cd $(BUILD); tar xf -)
110 sdcc-lib-z80:
111 make -C gbdk-lib/libc SDCCLIB=$(BUILD) PORTS=z80 PLATFORMS=consolez80
112 (cd gbdk-lib/build; tar cf - consolez80 z80) | (cd $(BUILD)/lib; tar xf -)
113 mkdir -p $(BUILD)/include/gbdk-lib
114 (cd gbdk-lib/include; tar cf - .) | (cd $(BUILD)/include/gbdk-lib; tar xf -)
116 sdcc-lib-gen:
117 make -C sdcc sdcc-device
119 lcc:
120 make -C gbdk-support/lcc SDCCLIB=$(SDCC_ROOT)/ TNP=$(TNP)
121 cp gbdk-support/lcc/lcc$(SE) $(BUILD)/bin/lcc$(E)
123 sdcc/sdccconf.h: sdcc/configure
124 ifdef TNP
125 cd sdcc; \
126 export CCC=$(TNP)c++; \
127 export RANLIB=$(TNP)ranlib; \
128 export CC=$(TNP)gcc; \
129 ./configure --datarootdir=$(SDCC_ROOT)
130 echo $$CCC
131 else
132 cd sdcc; ./configure --datarootdir=$(SDCC_ROOT)
133 endif
135 dist: _sdcc lcc tidy
137 zdist: dist
138 tar czf gbdk-$(VER).tar.gz gbdk
140 logged_in:
141 cvs -d$(ROOT_GBDK) login
142 cvs -d$(ROOT_SDCC) login
143 touch logged_in
144 make -f build.mak update