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
; \
7 TOPDIR
:= $(shell if
[ "$$PWD" != "" ]; then echo
$$PWD; else pwd
; fi
)
9 BUILD
= $(TOPDIR
)/build
/sdcc
17 # Used as a branch name.
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
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
)
35 SDCC_ROOT
= /usr
/lib
/$(SDCC_OR_GBDK
)
38 ifeq ($(COMPILE_MODE
),linux-mingw32
)
39 # For mingw32 hosted on Linux
42 # Source extension - what the gcc generated files have appended
44 # Dest extenstion - what extension we want them to have.
46 SDCC_ROOT
= /$(SDCC_OR_GBDK
)
47 # Set to cross to bypass the detection
51 ifeq ($(COMPILE_MODE
),cygwin-mingw32
)
52 # For mingw32 on win32
53 # Source extension - what the gcc generated files have appended
55 # Dest extenstion - what extension we want them to have.
56 SDCC_ROOT
= /$(SDCC_OR_GBDK
)
62 for i in sdcc gbdk-lib gbdk-support
/lcc
; do make
-C
$$i clean; done
64 rm -rf
$(BUILD
) gbdk-lib gbdk-support sdcc 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
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
)
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
)
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
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
-)
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
-)
117 make
-C sdcc sdcc-device
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
126 export CCC
=$(TNP
)c
++; \
127 export RANLIB
=$(TNP
)ranlib
; \
128 export CC
=$(TNP
)gcc
; \
129 .
/configure
--datarootdir
=$(SDCC_ROOT
)
132 cd sdcc
; .
/configure
--datarootdir
=$(SDCC_ROOT
)
138 tar czf gbdk-
$(VER
).
tar.gz gbdk
141 cvs
-d
$(ROOT_GBDK
) login
142 cvs
-d
$(ROOT_SDCC
) login
144 make
-f build.mak update