Subversion Repositories avr32-toolchain

Rev

Rev 10 | Rev 12 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10 Rev 11
1
# AVR32 Toolchain Makefile
1
# AVR32 Toolchain Makefile
2
#
2
#
3
# Copyright (C) 2011 by James Snyder <jbsnyder@fanplastic.org>
3
# Copyright (C) 2011 by James Snyder <jbsnyder@fanplastic.org>
4
#
4
#
5
# Permission is hereby granted, free of charge, to any person obtaining a copy
5
# Permission is hereby granted, free of charge, to any person obtaining a copy
6
# of this software and associated documentation files (the "Software"), to deal
6
# of this software and associated documentation files (the "Software"), to deal
7
# in the Software without restriction, including without limitation the rights
7
# in the Software without restriction, including without limitation the rights
8
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
# copies of the Software, and to permit persons to whom the Software is
9
# copies of the Software, and to permit persons to whom the Software is
10
# furnished to do so, subject to the following conditions:
10
# furnished to do so, subject to the following conditions:
11
#
11
#
12
# The above copyright notice and this permission notice shall be included in
12
# The above copyright notice and this permission notice shall be included in
13
# all copies or substantial portions of the Software.
13
# all copies or substantial portions of the Software.
14
#
14
#
15
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
# THE SOFTWARE.
21
# THE SOFTWARE.
22
22
23
#### PRIMARY TOOLCHAIN VERSIONS #####
23
#### PRIMARY TOOLCHAIN VERSIONS #####
24
24
25
GCC_VERSION       = 4.4.3
25
GCC_VERSION       = 4.4.3
26
GDB_VERSION_DLOAD = 6.7.1a
26
GDB_VERSION_DLOAD = 6.7.1a
27
GDB_VERSION       = 6.7.1
27
GDB_VERSION       = 6.7.1
28
BINUTILS_VERSION  = 2.20.1
28
BINUTILS_VERSION  = 2.20.1
29
NEWLIB_VERSION    = 1.16.0
29
NEWLIB_VERSION    = 1.16.0
30
DFU_VERSION       = 0.5.4
30
DFU_VERSION       = 0.5.4
31
AVR_PATCH_REV	  = 3.2.3.261
31
AVR_PATCH_REV	  = 3.2.3.261
32
AVR_HEADER_REV    = 3.2.3.258
32
AVR_HEADER_REV    = 3.2.3.258
33
33
34
34
35
#### PATHS AND ENVIRONMENT VARIABLES #####
35
#### PATHS AND ENVIRONMENT VARIABLES #####
36
36
37
SHELL       = /bin/bash
37
SHELL       = /bin/bash
38
TARGET      = avr32
38
TARGET      = avr32
39
39
40
TODAY = $(shell date "+%Y%m%d")
40
TODAY = $(shell date "+%Y%m%d")
41
GIT_REV	    = $(shell git rev-parse --verify HEAD --short 2> /dev/null)
41
GIT_REV	    = $(shell git rev-parse --verify HEAD --short 2> /dev/null)
42
SVN_REV	    = $(shell head -1 ReleaseNotes 2> /dev/null | cut -f 1 -d " ")
42
SVN_REV	    = $(shell head -1 ReleaseNotes 2> /dev/null | cut -f 1 -d " ")
43
43
44
ifeq ($(strip $(GIT_REV)),)
44
ifeq ($(strip $(GIT_REV)),)
45
ifeq ($(strip $(SVN_REV)),)
45
ifeq ($(strip $(SVN_REV)),)
46
PREFIX     ?= $(HOME)/avr32-tools-$(TODAY)
46
PREFIX     ?= $(HOME)/avr32-tools-$(TODAY)
47
TOOL_REV   = $(TODAY)
47
TOOL_REV   = $(TODAY)
48
else
48
else
49
PREFIX     ?= $(HOME)/avr32-tools-$(SVN_REV)
49
PREFIX     ?= $(HOME)/avr32-tools-$(SVN_REV)
50
TOOL_REV   = $(SVN_REV)
50
TOOL_REV   = $(SVN_REV)
51
BUG_URL = jasmin@anw.at
51
BUG_URL = jasmin@anw.at
52
endif
52
endif
53
else
53
else
54
PREFIX     ?= $(HOME)/avr32-tools-$(GIT_REV)
54
PREFIX     ?= $(HOME)/avr32-tools-$(GIT_REV)
55
TOOL_REV   = $(GIT_REV)
55
TOOL_REV   = $(GIT_REV)
56
endif
56
endif
57
57
58
ifeq ($(UNAME), Linux)
58
ifeq ($(UNAME), Linux)
59
PROCS  ?= $(shell grep -c ^processor /proc/cpuinfo)
59
PROCS  ?= $(shell grep -c ^processor /proc/cpuinfo)
60
else ifeq ($(UNAME), Darwin)
60
else ifeq ($(UNAME), Darwin)
61
PROCS  ?= $(shell sysctl hw.ncpu | awk '{print $$2}')
61
PROCS  ?= $(shell sysctl hw.ncpu | awk '{print $$2}')
62
else
62
else
63
PROCS  ?= 2
63
PROCS  ?= 2
64
endif
64
endif
65
65
66
SUPP_PREFIX = $(CURDIR)/supp
66
SUPP_PREFIX = $(CURDIR)/supp
67
PATH       := ${PREFIX}/bin:${SUPP_PREFIX}/bin:${PATH}
67
PATH       := ${PREFIX}/bin:${SUPP_PREFIX}/bin:${PATH}
68
AUTOCONF    = $(SUPP_PREFIX)/bin/autoconf
68
AUTOCONF    = $(SUPP_PREFIX)/bin/autoconf
69
AUTOMAKE    = $(SUPP_PREFIX)/bin/automake
69
AUTOMAKE    = $(SUPP_PREFIX)/bin/automake
70
70
71
STAMP_DIR  := $(CURDIR)/stamps
71
STAMP_DIR  := $(CURDIR)/stamps
72
DOWNLOAD_DIR := $(CURDIR)/downloads
72
DOWNLOAD_DIR := $(CURDIR)/downloads
73
73
74
ifeq ($(strip $(BUG_URL)),)
74
ifeq ($(strip $(BUG_URL)),)
75
BUG_URL = https://github.com/jsnyder/avr32-toolchain
75
BUG_URL = https://github.com/jsnyder/avr32-toolchain
76
endif
76
endif
77
PKG_VERSION = "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)"
77
PKG_VERSION = "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)"
78
78
79
79
80
#### PRIMARY TOOLCHAIN URLS #####
80
#### PRIMARY TOOLCHAIN URLS #####
81
81
82
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
82
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
83
GCC_URL = http://mirror.anl.gov/pub/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE)
83
GCC_URL = http://mirror.anl.gov/pub/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE)
84
GCC_MD5 = fe1ca818fc6d2caeffc9051fe67ff103
84
GCC_MD5 = fe1ca818fc6d2caeffc9051fe67ff103
85
85
86
GDB_ARCHIVE = gdb-$(GDB_VERSION_DLOAD).tar.bz2
86
GDB_ARCHIVE = gdb-$(GDB_VERSION_DLOAD).tar.bz2
87
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
87
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
88
GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214
88
GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214
89
89
90
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
90
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
91
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
91
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
92
BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
92
BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
93
93
94
NEWLIB_ARCHIVE = newlib-$(NEWLIB_VERSION).tar.gz
94
NEWLIB_ARCHIVE = newlib-$(NEWLIB_VERSION).tar.gz
95
NEWLIB_URL = ftp://sources.redhat.com/pub/newlib/$(NEWLIB_ARCHIVE)
95
NEWLIB_URL = ftp://sources.redhat.com/pub/newlib/$(NEWLIB_ARCHIVE)
96
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
96
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
97
97
98
AVR32PATCHES_ARCHIVE = avr32-gnu-toolchain-$(AVR_PATCH_REV)-source.zip
98
AVR32PATCHES_ARCHIVE = avr32-gnu-toolchain-$(AVR_PATCH_REV)-source.zip
99
AVR32PATCHES_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32PATCHES_ARCHIVE)
99
AVR32PATCHES_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32PATCHES_ARCHIVE)
100
AVR32PATCHES_MD5 = 69a03828a328068f25d457cfd8341857
100
AVR32PATCHES_MD5 = 69a03828a328068f25d457cfd8341857
101
101
102
AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip
102
AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip
103
AVR32HEADERS_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32HEADERS_ARCHIVE)
103
AVR32HEADERS_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32HEADERS_ARCHIVE)
104
AVR32HEADERS_MD5 = 3293d70a46e460d342e1f939b8e0d228
104
AVR32HEADERS_MD5 = 3293d70a46e460d342e1f939b8e0d228
105
105
106
DFU_ARCHIVE = dfu-programmer-$(DFU_VERSION).tar.gz
106
DFU_ARCHIVE = dfu-programmer-$(DFU_VERSION).tar.gz
107
DFU_URL = http://surfnet.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/$(DFU_VERSION)/$(DFU_ARCHIVE)
107
DFU_URL = http://surfnet.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/$(DFU_VERSION)/$(DFU_ARCHIVE)
108
DFU_MD5 = 707dcd0f957a74e92456ea6919faa772
108
DFU_MD5 = 707dcd0f957a74e92456ea6919faa772
109
109
110
110
111
##### SUPPORT TOOLS VERSIONS / URLS ######
111
##### SUPPORT TOOLS VERSIONS / URLS ######
112
AUTOCONF_VERSION = 2.64
112
AUTOCONF_VERSION = 2.64
113
AUTOMAKE_VERSION = 1.11
113
AUTOMAKE_VERSION = 1.11
114
MPC_VERSION = 0.8.1
114
MPC_VERSION = 0.8.1
115
115
116
AUTOCONF_ARCHIVE = autoconf-$(AUTOCONF_VERSION).tar.bz2
116
AUTOCONF_ARCHIVE = autoconf-$(AUTOCONF_VERSION).tar.bz2
117
AUTOCONF_URL = http://mirror.anl.gov/pub/gnu/autoconf/$(AUTOCONF_ARCHIVE)
117
AUTOCONF_URL = http://mirror.anl.gov/pub/gnu/autoconf/$(AUTOCONF_ARCHIVE)
118
AUTOCONF_MD5 = ef400d672005e0be21e0d20648169074
118
AUTOCONF_MD5 = ef400d672005e0be21e0d20648169074
119
119
120
AUTOMAKE_ARCHIVE = automake-$(AUTOMAKE_VERSION).tar.bz2
120
AUTOMAKE_ARCHIVE = automake-$(AUTOMAKE_VERSION).tar.bz2
121
AUTOMAKE_URL = http://mirror.anl.gov/pub/gnu/automake/$(AUTOMAKE_ARCHIVE)
121
AUTOMAKE_URL = http://mirror.anl.gov/pub/gnu/automake/$(AUTOMAKE_ARCHIVE)
122
AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
122
AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
123
123
124
124
125
125
126
.PHONY: install-tools
126
.PHONY: install-tools
127
install-tools: install-binutils install-final-gcc install-newlib install-headers
127
install-tools: install-binutils install-final-gcc install-newlib install-headers
128
128
129
.PHONY: install-cross
129
.PHONY: install-cross
130
install-cross: install-tools install-note
130
install-cross: install-tools install-note
131
131
132
132
133
.PHONY: sudomode
133
.PHONY: sudomode
134
sudomode:
134
sudomode:
135
ifneq ($(USER),root)
135
ifneq ($(USER),root)
136
	@echo Please run this target with sudo!
136
	@echo Please run this target with sudo!
137
	@echo e.g.: sudo make targetname
137
	@echo e.g.: sudo make targetname
138
	@exit 1
138
	@exit 1
139
endif
139
endif
140
140
141
141
142
.PHONY: tst
142
.PHONY: tst
143
tst:
143
tst:
144
	@echo "PREFIX=$(PREFIX)"
144
	@echo "PREFIX=$(PREFIX)"
145
	@echo "PKG_VERSION=$(PKG_VERSION)"
145
	@echo "PKG_VERSION=$(PKG_VERSION)"
146
	@echo "BUG_URL=$(BUG_URL)"
146
	@echo "BUG_URL=$(BUG_URL)"
147
147
148
148
149
############ MACROS for the lazy people ;-) ############
149
############ MACROS for the lazy people ;-) ############
150
150
151
ifeq ($(strip $(MAKEFLAGS)),s)
151
ifeq ($(strip $(MAKEFLAGS)),s)
152
define quiet_text
152
define quiet_text
153
	@echo "$1"
153
	@echo "$1"
154
endef
154
endef
155
else
155
else
156
define quiet_text
156
define quiet_text
157
endef
157
endef
158
endif
158
endif
159
159
160
## remove a stamp
160
## remove a stamp
161
define rm_stamp
161
define rm_stamp
162
	rm -f $(STAMP_DIR)/$(1)
162
	rm -f $(STAMP_DIR)/$(1)
163
endef
163
endef
164
164
165
## create the stamp directory if not existing and the stamp
165
## create the stamp directory if not existing and the stamp
166
define make_stamp
166
define make_stamp
167
	@[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR)
167
	@[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR)
168
	date > $(STAMP_DIR)/$(1)
168
	date > $(STAMP_DIR)/$(1)
169
endef
169
endef
170
170
-
 
171
define GET_MY_VARS
-
 
172
UP_$(1):=$$(shell echo "$(1)" | tr '[a-z]' '[A-Z]')
-
 
173
MY_ARCHIVE:=$$($$(UP_$(1))_ARCHIVE)
-
 
174
MY_URL:=$$($$(UP_$(1))_URL)
-
 
175
MY_MD5:=$$($$(UP_$(1))_MD5)
-
 
176
endef	                         
-
 
177
171
## create the download rule and force download rule
178
## create the download rule and force download rule
172
define DOWNLOAD_template
179
define DOWNLOAD_template
-
 
180
$(call GET_MY_VARS,$(1))
173
download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
181
download-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE)
174
download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE): $(DOWNLOAD_DIR)
182
download-$(1)-f $(DOWNLOAD_DIR)/$$(MY_ARCHIVE): $(DOWNLOAD_DIR)
175
	cd $(DOWNLOAD_DIR) && curl -LO $$($(1)_URL)
183
	cd $(DOWNLOAD_DIR) && curl -LO $$(MY_URL)
176
PHONY += download-$(1) download-$(1)-f
184
PHONY += download-$(1) download-$(1)-f
177
endef
185
endef
178
186
179
## extract commands
187
## extract commands
180
EXT_BZ2 := tar -jxf
188
EXT_BZ2 := tar -jxf
181
EXT_TGZ := tar -xf
189
EXT_TGZ := tar -xf
182
EXT_ZIP := unzip -o
190
EXT_ZIP := unzip -o
183
191
184
## create the extract rule and force extract rule
192
## create the extract rule and force extract rule
185
define EXTRACT_template
193
define EXTRACT_template
-
 
194
$(call GET_MY_VARS,$(1))
186
extract-$(1): $(STAMP_DIR)/extract-$(1)
195
extract-$(1): $(STAMP_DIR)/extract-$(1)
187
extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
196
extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE)
188
	@(rm -rf autoconf-*; \
197
	@(rm -rf autoconf-*; \
189
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
198
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
190
	[ "$$$$t1" = "$$($(1)_MD5)" ] || \
199
	[ "$$$$t1" = "$$(MY_MD5)" ] || \
191
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
200
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
192
	$(call quiet_text,"Extracting $$($(1)_ARCHIVE)")
201
	$(call quiet_text,"Extracting $$(MY_ARCHIVE)")
193
	$($(2)) $$<
202
	$($(2)) $$<
194
	$(call make_stamp,extract-$(1))
203
	$(call make_stamp,extract-$(1))
195
PHONY += extract-$(1) extract-$(1)-f
204
PHONY += extract-$(1) extract-$(1)-f
196
endef
205
endef
197
206
198
$(DOWNLOAD_DIR):
207
$(DOWNLOAD_DIR):
199
	mkdir $(DOWNLOAD_DIR)
208
	mkdir $(DOWNLOAD_DIR)
200
209
201
$(eval $(call DOWNLOAD_template,AUTOCONF))
210
$(eval $(call DOWNLOAD_template,autoconf))
202
$(eval $(call EXTRACT_template,AUTOCONF,EXT_BZ2))
211
$(eval $(call EXTRACT_template,autoconf,EXT_BZ2))
203
212
204
.PHONY: $(PHONY)
213
.PHONY: $(PHONY)
205
214
206
215
207
.PHONY: tst2 tst3
216
.PHONY: tst2 tst3
208
tst2:
217
tst2:
209
	$(call make_stamp,JES)
218
	$(call make_stamp,JES)
210
tst3:
219
tst3:
211
	$(call rm_stamp,JES)
220
	$(call rm_stamp,JES)
212
221
213
222
214
.PHONY: install-note
223
.PHONY: install-note
215
install-note: install-tools
224
install-note: install-tools
216
	@echo
225
	@echo
217
	@echo ====== INSTALLATION NOTE ======
226
	@echo ====== INSTALLATION NOTE ======
218
	@echo Your tools have now been installed at the following prefix:
227
	@echo Your tools have now been installed at the following prefix:
219
	@echo $(PREFIX)
228
	@echo $(PREFIX)
220
	@echo
229
	@echo
221
	@echo Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:
230
	@echo Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:
222
	@echo export PATH=$(PREFIX)/bin:'$$PATH'
231
	@echo export PATH=$(PREFIX)/bin:'$$PATH'
223
232
224
233
225
.PHONY: install-supp-tools install-supp-tools-force
234
.PHONY: install-supp-tools install-supp-tools-force
226
install-supp-tools: stamps/install-supp-tools
235
install-supp-tools: stamps/install-supp-tools
227
install-supp-tools-force stamps/install-supp-tools: stamps/install-autoconf stamps/install-automake
236
install-supp-tools-force stamps/install-supp-tools: stamps/install-autoconf stamps/install-automake
228
	[ -d stamps ] || mkdir stamps ;
237
	[ -d stamps ] || mkdir stamps ;
229
	touch stamps/install-supp-tools;
238
	touch stamps/install-supp-tools;
230
239
231
.PHONY: clean-supp-tools
240
.PHONY: clean-supp-tools
232
clean-supp-tools: clean-autoconf clean-automake
241
clean-supp-tools: clean-autoconf clean-automake
233
	rm stamps/install-supp-tools;
242
	rm stamps/install-supp-tools;
234
243
235
.PHONY: realclean-supp-tools
244
.PHONY: realclean-supp-tools
236
realclean-supp-tools: realclean-autoconf realclean-automake
245
realclean-supp-tools: realclean-autoconf realclean-automake
237
	rm stamps/install-supp-tools;
246
	rm stamps/install-supp-tools;
238
247
239
248
240
############# SUPP: AUTOCONF ############
249
############# SUPP: AUTOCONF ############
241
250
242
##.PHONY: download-autoconf download-autoconf-force
251
##.PHONY: download-autoconf download-autoconf-force
243
##download-autoconf: downloads/$(AUTOCONF_ARCHIVE)
252
##download-autoconf: downloads/$(AUTOCONF_ARCHIVE)
244
##download-autoconf-force downloads/$(AUTOCONF_ARCHIVE):
253
##download-autoconf-force downloads/$(AUTOCONF_ARCHIVE):
245
##	[ -d downloads ] || mkdir downloads ;
254
##	[ -d downloads ] || mkdir downloads ;
246
##	cd downloads && curl -LO $(AUTOCONF_URL)
255
##	cd downloads && curl -LO $(AUTOCONF_URL)
247
256
248
##.PHONY: extract-autoconf extract-autoconf-force
257
##.PHONY: extract-autoconf extract-autoconf-force
249
##extract-autoconf: stamps/extract-autoconf
258
##extract-autoconf: stamps/extract-autoconf
250
##extract-autoconf-force stamps/extract-autoconf: downloads/$(AUTOCONF_ARCHIVE)
259
##extract-autoconf-force stamps/extract-autoconf: downloads/$(AUTOCONF_ARCHIVE)
251
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
260
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
252
##	[ "$$t1" = "$(AUTOCONF_MD5)" ] || \
261
##	[ "$$t1" = "$(AUTOCONF_MD5)" ] || \
253
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
262
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
254
##	tar -jxf $< ;
263
##	tar -jxf $< ;
255
##	[ -d stamps ] || mkdir stamps ;
264
##	[ -d stamps ] || mkdir stamps ;
256
##	touch stamps/extract-autoconf;
265
##	touch stamps/extract-autoconf;
257
266
258
.PHONY: build-autoconf build-autoconf-force
267
.PHONY: build-autoconf build-autoconf-force
259
build-autoconf: stamps/build-autoconf
268
build-autoconf: stamps/build-autoconf
260
build-autoconf-force stamps/build-autoconf: stamps/extract-autoconf
269
build-autoconf-force stamps/build-autoconf: stamps/extract-autoconf
261
	mkdir -p build/autoconf && cd build/autoconf && \
270
	mkdir -p build/autoconf && cd build/autoconf && \
262
	../../autoconf-$(AUTOCONF_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
271
	../../autoconf-$(AUTOCONF_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
263
	$(MAKE) -j$(PROCS)
272
	$(MAKE) -j$(PROCS)
264
	[ -d stamps ] || mkdir stamps
273
	[ -d stamps ] || mkdir stamps
265
	touch stamps/build-autoconf;
274
	touch stamps/build-autoconf;
266
275
267
.PHONY: install-autoconf install-autoconf-force
276
.PHONY: install-autoconf install-autoconf-force
268
install-autoconf: stamps/install-autoconf
277
install-autoconf: stamps/install-autoconf
269
install-autoconf-force stamps/install-autoconf:  stamps/build-autoconf
278
install-autoconf-force stamps/install-autoconf:  stamps/build-autoconf
270
	cd build/autoconf && \
279
	cd build/autoconf && \
271
	$(MAKE) install
280
	$(MAKE) install
272
	[ -d stamps ] || mkdir stamps
281
	[ -d stamps ] || mkdir stamps
273
	touch stamps/install-autoconf;
282
	touch stamps/install-autoconf;
274
283
275
.PHONY: clean-autoconf
284
.PHONY: clean-autoconf
276
clean-autoconf:
285
clean-autoconf:
277
	rm -rf build/autoconf stamps/*-autoconf autoconf-*
286
	rm -rf build/autoconf stamps/*-autoconf autoconf-*
278
287
279
.PHONY: realclean-autoconf
288
.PHONY: realclean-autoconf
280
realclean-autoconf: clean-autoconf
289
realclean-autoconf: clean-autoconf
281
	rm downloads/$(AUTOCONF_ARCHIVE)
290
	rm downloads/$(AUTOCONF_ARCHIVE)
282
291
283
292
284
############ SUPP: AUTOMAKE ############
293
############ SUPP: AUTOMAKE ############
285
294
286
.PHONY: download-automake download-automake-force
295
.PHONY: download-automake download-automake-force
287
download-automake: downloads/$(AUTOMAKE_ARCHIVE)
296
download-automake: downloads/$(AUTOMAKE_ARCHIVE)
288
download-automake-force downloads/$(AUTOMAKE_ARCHIVE):
297
download-automake-force downloads/$(AUTOMAKE_ARCHIVE):
289
	[ -d downloads ] || mkdir downloads ;
298
	[ -d downloads ] || mkdir downloads ;
290
	cd downloads && curl -LO $(AUTOMAKE_URL)
299
	cd downloads && curl -LO $(AUTOMAKE_URL)
291
300
292
.PHONY: extract-automake extract-automake-force
301
.PHONY: extract-automake extract-automake-force
293
extract-automake: stamps/extract-automake
302
extract-automake: stamps/extract-automake
294
extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE)
303
extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE)
295
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
304
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
296
	[ "$$t1" = "$(AUTOMAKE_MD5)" ] || \
305
	[ "$$t1" = "$(AUTOMAKE_MD5)" ] || \
297
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
306
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
298
	tar -jxf $< ;
307
	tar -jxf $< ;
299
	[ -d stamps ] || mkdir stamps ;
308
	[ -d stamps ] || mkdir stamps ;
300
	touch stamps/extract-automake;
309
	touch stamps/extract-automake;
301
310
302
.PHONY: build-automake build-automake-force
311
.PHONY: build-automake build-automake-force
303
build-automake: stamps/build-automake
312
build-automake: stamps/build-automake
304
build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf
313
build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf
305
	mkdir -p build/automake && cd build/automake && \
314
	mkdir -p build/automake && cd build/automake && \
306
	../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
315
	../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
307
	$(MAKE) -j$(PROCS)
316
	$(MAKE) -j$(PROCS)
308
	[ -d stamps ] || mkdir stamps
317
	[ -d stamps ] || mkdir stamps
309
	touch stamps/build-automake;
318
	touch stamps/build-automake;
310
319
311
.PHONY: install-automake install-automake-force
320
.PHONY: install-automake install-automake-force
312
install-automake: stamps/install-automake
321
install-automake: stamps/install-automake
313
install-automake-force stamps/install-automake: stamps/build-automake
322
install-automake-force stamps/install-automake: stamps/build-automake
314
	cd build/automake && \
323
	cd build/automake && \
315
	$(MAKE) install
324
	$(MAKE) install
316
	[ -d stamps ] || mkdir stamps
325
	[ -d stamps ] || mkdir stamps
317
	touch stamps/install-automake;
326
	touch stamps/install-automake;
318
327
319
.PHONY: clean-automake
328
.PHONY: clean-automake
320
clean-automake:
329
clean-automake:
321
	rm -rf build/automake stamps/*-automake automake-*
330
	rm -rf build/automake stamps/*-automake automake-*
322
331
323
.PHONY: realclean-automake
332
.PHONY: realclean-automake
324
realclean-automake: clean-automake
333
realclean-automake: clean-automake
325
	rm downloads/$(AUTOMAKE_ARCHIVE)
334
	rm downloads/$(AUTOMAKE_ARCHIVE)
326
335
327
336
328
############# AVR32 PATCHES ############
337
############# AVR32 PATCHES ############
329
338
330
.PHONY: download-avr32patches download-avr32patches-force
339
.PHONY: download-avr32patches download-avr32patches-force
331
download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
340
download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
332
download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE):
341
download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE):
333
	cd downloads && curl -LO $(AVR32PATCHES_URL)
342
	cd downloads && curl -LO $(AVR32PATCHES_URL)
334
343
335
.PHONY: extract-avr32patches extract-avr32patches-force
344
.PHONY: extract-avr32patches extract-avr32patches-force
336
extract-avr32patches: stamps/extract-avr32patches
345
extract-avr32patches: stamps/extract-avr32patches
337
extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
346
extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
338
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
347
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
339
	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
348
	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
340
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
349
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
341
	unzip -o $<
350
	unzip -o $<
342
	[ -d stamps ] || mkdir stamps
351
	[ -d stamps ] || mkdir stamps
343
	touch stamps/extract-avr32patches;
352
	touch stamps/extract-avr32patches;
344
353
345
.PHONY: clean-avr32patches
354
.PHONY: clean-avr32patches
346
clean-avr32patches:
355
clean-avr32patches:
347
	rm -rf stamps/*-avr32patches source
356
	rm -rf stamps/*-avr32patches source
348
357
349
.PHONY: realclean-avr32patches
358
.PHONY: realclean-avr32patches
350
realclean-avr32patches: clean-avr32patches
359
realclean-avr32patches: clean-avr32patches
351
	rm downloads/$(AVR32PATCHES_ARCHIVE)
360
	rm downloads/$(AVR32PATCHES_ARCHIVE)
352
361
353
362
354
############# AVR32 HEADERS ############
363
############# AVR32 HEADERS ############
355
364
356
.PHONY: download-avr32headers download-avr32headers-force
365
.PHONY: download-avr32headers download-avr32headers-force
357
download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE)
366
download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE)
358
download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE):
367
download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE):
359
	cd downloads && curl -LO $(AVR32HEADERS_URL)
368
	cd downloads && curl -LO $(AVR32HEADERS_URL)
360
369
361
.PHONY: install-headers install-headers-force
370
.PHONY: install-headers install-headers-force
362
install-headers: stamps/install-headers
371
install-headers: stamps/install-headers
363
install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
372
install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
364
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
373
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
365
	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
374
	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
366
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
375
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
367
	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
376
	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
368
	[ -d stamps ] || mkdir stamps
377
	[ -d stamps ] || mkdir stamps
369
	touch stamps/install-headers;
378
	touch stamps/install-headers;
370
379
371
.PHONY: clean-headers
380
.PHONY: clean-headers
372
clean-headers:
381
clean-headers:
373
	rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32
382
	rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32
374
383
375
.PHONY: realclean-headers
384
.PHONY: realclean-headers
376
realclean-headers: clean-headers
385
realclean-headers: clean-headers
377
	rm downloads/$(AVR32HEADERS_ARCHIVE)
386
	rm downloads/$(AVR32HEADERS_ARCHIVE)
378
387
379
388
380
################ NEWLIB ################
389
################ NEWLIB ################
381
390
382
.PHONY: download-newlib download-newlib-force
391
.PHONY: download-newlib download-newlib-force
383
download-newlib: downloads/$(NEWLIB_ARCHIVE)
392
download-newlib: downloads/$(NEWLIB_ARCHIVE)
384
download-newlib-force downloads/$(NEWLIB_ARCHIVE):
393
download-newlib-force downloads/$(NEWLIB_ARCHIVE):
385
	[ -d downloads ] || mkdir downloads ;
394
	[ -d downloads ] || mkdir downloads ;
386
	cd downloads && curl -LO $(NEWLIB_URL)
395
	cd downloads && curl -LO $(NEWLIB_URL)
387
396
388
.PHONY: extract-newlib extract-newlib-force
397
.PHONY: extract-newlib extract-newlib-force
389
extract-newlib: stamps/extract-newlib
398
extract-newlib: stamps/extract-newlib
390
extract-newlib-force stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE)
399
extract-newlib-force stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE)
391
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
400
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
392
	[ "$$t1" = "$(NEWLIB_MD5)" ] || \
401
	[ "$$t1" = "$(NEWLIB_MD5)" ] || \
393
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
402
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
394
	tar -xf $<
403
	tar -xf $<
395
	[ -d stamps ] || mkdir stamps
404
	[ -d stamps ] || mkdir stamps
396
	touch stamps/extract-newlib;
405
	touch stamps/extract-newlib;
397
406
398
407
399
.PHONY: patch-newlib patch-newlib-force
408
.PHONY: patch-newlib patch-newlib-force
400
patch-newlib: stamps/patch-newlib
409
patch-newlib: stamps/patch-newlib
401
patch-newlib-force stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches
410
patch-newlib-force stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches
402
	pushd newlib-$(NEWLIB_VERSION) ; \
411
	pushd newlib-$(NEWLIB_VERSION) ; \
403
	for f in ../source/avr32/newlib/*.patch; do \
412
	for f in ../source/avr32/newlib/*.patch; do \
404
	patch -N -p0 <$${f} ; \
413
	patch -N -p0 <$${f} ; \
405
	done ; \
414
	done ; \
406
	popd ;
415
	popd ;
407
	[ -d stamps ] || mkdir stamps
416
	[ -d stamps ] || mkdir stamps
408
	touch stamps/patch-newlib;
417
	touch stamps/patch-newlib;
409
418
410
.PHONY: regen-newlib regen-newlib-force
419
.PHONY: regen-newlib regen-newlib-force
411
regen-newlib: stamps/regen-newlib
420
regen-newlib: stamps/regen-newlib
412
regen-newlib-force stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools
421
regen-newlib-force stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools
413
	pushd newlib-$(NEWLIB_VERSION) ; \
422
	pushd newlib-$(NEWLIB_VERSION) ; \
414
	"$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \
423
	"$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \
415
	for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \
424
	for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \
416
	  pushd $$dir ; \
425
	  pushd $$dir ; \
417
	  "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \
426
	  "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \
418
	  "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake"; \
427
	  "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake"; \
419
	  popd ; \
428
	  popd ; \
420
	done; \
429
	done; \
421
	popd;
430
	popd;
422
	[ -d stamps ] || mkdir stamps
431
	[ -d stamps ] || mkdir stamps
423
	touch stamps/regen-newlib;
432
	touch stamps/regen-newlib;
424
433
425
NEWLIB_FLAGS="-ffunction-sections -fdata-sections	\
434
NEWLIB_FLAGS="-ffunction-sections -fdata-sections	\
426
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os	\
435
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os	\
427
-fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128	\
436
-fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128	\
428
-DSMALL_MEMORY"
437
-DSMALL_MEMORY"
429
438
430
.PHONY: build-newlib build-newlib-force
439
.PHONY: build-newlib build-newlib-force
431
build-newlib: stamps/build-newlib
440
build-newlib: stamps/build-newlib
432
build-newlib-force stamps/build-newlib: stamps/regen-newlib stamps/install-binutils stamps/install-gcc
441
build-newlib-force stamps/build-newlib: stamps/regen-newlib stamps/install-binutils stamps/install-gcc
433
	mkdir -p build/newlib && cd build/newlib && \
442
	mkdir -p build/newlib && cd build/newlib && \
434
	pushd ../../newlib-$(NEWLIB_VERSION) ; \
443
	pushd ../../newlib-$(NEWLIB_VERSION) ; \
435
	make clean ; \
444
	make clean ; \
436
	popd ; \
445
	popd ; \
437
	../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX)	\
446
	../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX)	\
438
	--with-build-time-tools=$(PREFIX)				\
447
	--with-build-time-tools=$(PREFIX)				\
439
	--target=$(TARGET) --disable-newlib-supplied-syscalls		\
448
	--target=$(TARGET) --disable-newlib-supplied-syscalls		\
440
	--disable-libgloss --disable-nls --disable-shared		\
449
	--disable-libgloss --disable-nls --disable-shared		\
441
	--enable-newlib-io-long-long --enable-newlib-io-long-double	\
450
	--enable-newlib-io-long-long --enable-newlib-io-long-double	\
442
	--enable-target-optspace --enable-newlib-io-pos-args		\
451
	--enable-target-optspace --enable-newlib-io-pos-args		\
443
	--enable-newlib-reent-small  && \
452
	--enable-newlib-reent-small  && \
444
	$(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \
453
	$(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \
445
	[ -d stamps ] || mkdir stamps
454
	[ -d stamps ] || mkdir stamps
446
	touch stamps/build-newlib;
455
	touch stamps/build-newlib;
447
456
448
.PHONY: install-newlib install-newlib-force
457
.PHONY: install-newlib install-newlib-force
449
install-newlib: stamps/install-newlib
458
install-newlib: stamps/install-newlib
450
install-newlib-force stamps/install-newlib: stamps/build-newlib
459
install-newlib-force stamps/install-newlib: stamps/build-newlib
451
	cd build/newlib && \
460
	cd build/newlib && \
452
	$(MAKE) install
461
	$(MAKE) install
453
	[ -d stamps ] || mkdir stamps
462
	[ -d stamps ] || mkdir stamps
454
	touch stamps/install-newlib;
463
	touch stamps/install-newlib;
455
464
456
.PHONY: clean-newlib
465
.PHONY: clean-newlib
457
clean-newlib:
466
clean-newlib:
458
	rm -rf build/newlib stamps/*-newlib newlib-*
467
	rm -rf build/newlib stamps/*-newlib newlib-*
459
468
460
.PHONY: realclean-newlib
469
.PHONY: realclean-newlib
461
realclean-newlib: clean-newlib
470
realclean-newlib: clean-newlib
462
	rm downloads/$(NEWLIB_ARCHIVE)
471
	rm downloads/$(NEWLIB_ARCHIVE)
463
472
464
473
465
################ BINUTILS ################
474
################ BINUTILS ################
466
475
467
.PHONY: download-binutils download-binutils-force
476
.PHONY: download-binutils download-binutils-force
468
download-binutils: downloads/$(BINUTILS_ARCHIVE)
477
download-binutils: downloads/$(BINUTILS_ARCHIVE)
469
download-binutils-force downloads/$(BINUTILS_ARCHIVE):
478
download-binutils-force downloads/$(BINUTILS_ARCHIVE):
470
	[ -d downloads ] || mkdir downloads ;
479
	[ -d downloads ] || mkdir downloads ;
471
	cd downloads && curl -LO $(BINUTILS_URL)
480
	cd downloads && curl -LO $(BINUTILS_URL)
472
481
473
.PHONY: extract-binutils extract-binutils-force
482
.PHONY: extract-binutils extract-binutils-force
474
extract-binutils: stamps/extract-binutils
483
extract-binutils: stamps/extract-binutils
475
extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
484
extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
476
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
485
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
477
	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
486
	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
478
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
487
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
479
	tar -jxf $< ;
488
	tar -jxf $< ;
480
	[ -d stamps ] || mkdir stamps ;
489
	[ -d stamps ] || mkdir stamps ;
481
	touch stamps/extract-binutils;
490
	touch stamps/extract-binutils;
482
491
483
.PHONY: patch-binutils patch-binutils-force
492
.PHONY: patch-binutils patch-binutils-force
484
patch-binutils: stamps/patch-binutils
493
patch-binutils: stamps/patch-binutils
485
patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
494
patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
486
	pushd binutils-$(BINUTILS_VERSION) ; \
495
	pushd binutils-$(BINUTILS_VERSION) ; \
487
	for f in ../source/avr32/binutils/*.patch; do \
496
	for f in ../source/avr32/binutils/*.patch; do \
488
	patch -N -p0 <$${f} ; \
497
	patch -N -p0 <$${f} ; \
489
	done ; \
498
	done ; \
490
	popd ; \
499
	popd ; \
491
	[ -d stamps ] || mkdir stamps
500
	[ -d stamps ] || mkdir stamps
492
	touch stamps/patch-binutils;
501
	touch stamps/patch-binutils;
493
502
494
.PHONY: regen-binutils regen-binutils-force
503
.PHONY: regen-binutils regen-binutils-force
495
regen-binutils: stamps/regen-binutils
504
regen-binutils: stamps/regen-binutils
496
regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
505
regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
497
	pushd binutils-$(BINUTILS_VERSION) ; \
506
	pushd binutils-$(BINUTILS_VERSION) ; \
498
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
507
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
499
	"$(SUPP_PREFIX)/bin/autoconf" ; \
508
	"$(SUPP_PREFIX)/bin/autoconf" ; \
500
	"$(SUPP_PREFIX)/bin/automake" ; \
509
	"$(SUPP_PREFIX)/bin/automake" ; \
501
	"$(SUPP_PREFIX)/bin/autoheader" ; \
510
	"$(SUPP_PREFIX)/bin/autoheader" ; \
502
	for dir in bfd opcodes binutils gas ld; do \
511
	for dir in bfd opcodes binutils gas ld; do \
503
	  pushd $$dir ; \
512
	  pushd $$dir ; \
504
	  "$(SUPP_PREFIX)/bin/autoconf"; \
513
	  "$(SUPP_PREFIX)/bin/autoconf"; \
505
	  "$(SUPP_PREFIX)/bin/automake"; \
514
	  "$(SUPP_PREFIX)/bin/automake"; \
506
	  "$(SUPP_PREFIX)/bin/autoheader"; \
515
	  "$(SUPP_PREFIX)/bin/autoheader"; \
507
	  popd ; \
516
	  popd ; \
508
	done; \
517
	done; \
509
	popd; \
518
	popd; \
510
	[ -d stamps ] || mkdir stamps ;
519
	[ -d stamps ] || mkdir stamps ;
511
	touch stamps/regen-binutils;
520
	touch stamps/regen-binutils;
512
521
513
.PHONY: build-binutils build-binutils-force
522
.PHONY: build-binutils build-binutils-force
514
build-binutils: stamps/build-binutils
523
build-binutils: stamps/build-binutils
515
build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
524
build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
516
	cd binutils-$(BINUTILS_VERSION) ; \
525
	cd binutils-$(BINUTILS_VERSION) ; \
517
	./configure   --enable-maintainer-mode		\
526
	./configure   --enable-maintainer-mode		\
518
	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
527
	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
519
	--disable-shared --disable-werror				\
528
	--disable-shared --disable-werror				\
520
	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
529
	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
521
	$(MAKE) all-bfd TARGET-bfd=headers; \
530
	$(MAKE) all-bfd TARGET-bfd=headers; \
522
	rm bfd/Makefile; \
531
	rm bfd/Makefile; \
523
	make configure-bfd; \
532
	make configure-bfd; \
524
	$(MAKE)
533
	$(MAKE)
525
	[ -d stamps ] || mkdir stamps ;
534
	[ -d stamps ] || mkdir stamps ;
526
	touch stamps/build-binutils;
535
	touch stamps/build-binutils;
527
536
528
.PHONY: install-binutils install-binutils-force
537
.PHONY: install-binutils install-binutils-force
529
install-binutils: stamps/install-binutils
538
install-binutils: stamps/install-binutils
530
install-binutils-force stamps/install-binutils: stamps/build-binutils
539
install-binutils-force stamps/install-binutils: stamps/build-binutils
531
	cd binutils-$(BINUTILS_VERSION) && \
540
	cd binutils-$(BINUTILS_VERSION) && \
532
	$(MAKE) installdirs install-host install-target
541
	$(MAKE) installdirs install-host install-target
533
	[ -d stamps ] || mkdir stamps ;
542
	[ -d stamps ] || mkdir stamps ;
534
	touch stamps/install-binutils;
543
	touch stamps/install-binutils;
535
544
536
545
537
.PHONY: clean-binutils
546
.PHONY: clean-binutils
538
clean-binutils:
547
clean-binutils:
539
	rm -rf build/binutils stamps/*-binutils binutils-*
548
	rm -rf build/binutils stamps/*-binutils binutils-*
540
549
541
.PHONY: realclean-binutils
550
.PHONY: realclean-binutils
542
realclean-binutils: clean-binutils
551
realclean-binutils: clean-binutils
543
	rm downloads/$(BINUTILS_ARCHIVE)
552
	rm downloads/$(BINUTILS_ARCHIVE)
544
553
545
554
546
########## DFU PROGRAMMER ###########
555
########## DFU PROGRAMMER ###########
547
556
548
.PHONY: download-dfu download-dfu-force
557
.PHONY: download-dfu download-dfu-force
549
download-dfu: downloads/$(DFU_ARCHIVE)
558
download-dfu: downloads/$(DFU_ARCHIVE)
550
download-dfu-force downloads/$(DFU_ARCHIVE):
559
download-dfu-force downloads/$(DFU_ARCHIVE):
551
	[ -d downloads ] || mkdir downloads ;
560
	[ -d downloads ] || mkdir downloads ;
552
	cd downloads && curl -LO $(DFU_URL)
561
	cd downloads && curl -LO $(DFU_URL)
553
562
554
.PHONY: extract-dfu extract-dfu-force
563
.PHONY: extract-dfu extract-dfu-force
555
extract-dfu: stamps/extract-dfu
564
extract-dfu: stamps/extract-dfu
556
extract-dfu-force stamps/extract-dfu: downloads/$(DFU_ARCHIVE)
565
extract-dfu-force stamps/extract-dfu: downloads/$(DFU_ARCHIVE)
557
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
566
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
558
	[ "$$t1" = "$(DFU_MD5)" ] || \
567
	[ "$$t1" = "$(DFU_MD5)" ] || \
559
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
568
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
560
	tar -zxf $< ;
569
	tar -zxf $< ;
561
	[ -d stamps ] || mkdir stamps ;
570
	[ -d stamps ] || mkdir stamps ;
562
	touch stamps/extract-dfu;
571
	touch stamps/extract-dfu;
563
572
564
.PHONY: build-dfu build-dfu-force
573
.PHONY: build-dfu build-dfu-force
565
build-dfu: stamps/build-dfu
574
build-dfu: stamps/build-dfu
566
build-dfu-force stamps/build-dfu: stamps/extract-dfu
575
build-dfu-force stamps/build-dfu: stamps/extract-dfu
567
	mkdir -p build/dfu-programmer && cd build/dfu-programmer && \
576
	mkdir -p build/dfu-programmer && cd build/dfu-programmer && \
568
	../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \
577
	../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \
569
	$(MAKE) -j$(PROCS)
578
	$(MAKE) -j$(PROCS)
570
	[ -d stamps ] || mkdir stamps
579
	[ -d stamps ] || mkdir stamps
571
	touch stamps/build-dfu;
580
	touch stamps/build-dfu;
572
581
573
.PHONY: install-dfu install-dfu-force
582
.PHONY: install-dfu install-dfu-force
574
install-dfu: stamps/install-dfu
583
install-dfu: stamps/install-dfu
575
install-dfu-force stamps/install-dfu: stamps/build-dfu
584
install-dfu-force stamps/install-dfu: stamps/build-dfu
576
	cd build/dfu-programmer && \
585
	cd build/dfu-programmer && \
577
	$(MAKE) install
586
	$(MAKE) install
578
	[ -d stamps ] || mkdir stamps
587
	[ -d stamps ] || mkdir stamps
579
	touch stamps/install-dfu;
588
	touch stamps/install-dfu;
580
589
581
.PHONY: clean-dfu
590
.PHONY: clean-dfu
582
clean-dfu:
591
clean-dfu:
583
	rm -rf build/dfu stamps/*-dfu dfu-*
592
	rm -rf build/dfu stamps/*-dfu dfu-*
584
593
585
.PHONY: realclean-dfu
594
.PHONY: realclean-dfu
586
realclean-dfu: clean-dfu
595
realclean-dfu: clean-dfu
587
	rm downloads/$(DFU_ARCHIVE)
596
	rm downloads/$(DFU_ARCHIVE)
588
597
589
598
590
################ Bootstrap GCC ################
599
################ Bootstrap GCC ################
591
600
592
.PHONY: download-gcc download-gcc-force
601
.PHONY: download-gcc download-gcc-force
593
download-gcc: downloads/$(GCC_ARCHIVE)
602
download-gcc: downloads/$(GCC_ARCHIVE)
594
download-gcc-force downloads/$(GCC_ARCHIVE):
603
download-gcc-force downloads/$(GCC_ARCHIVE):
595
	[ -d downloads ] || mkdir downloads ;
604
	[ -d downloads ] || mkdir downloads ;
596
	cd downloads && curl -LO $(GCC_URL)
605
	cd downloads && curl -LO $(GCC_URL)
597
606
598
.PHONY: extract-gcc extract-gcc-force
607
.PHONY: extract-gcc extract-gcc-force
599
extract-gcc: stamps/extract-gcc
608
extract-gcc: stamps/extract-gcc
600
extract-gcc-force stamps/extract-gcc: downloads/$(GCC_ARCHIVE)
609
extract-gcc-force stamps/extract-gcc: downloads/$(GCC_ARCHIVE)
601
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
610
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
602
	[ "$$t1" = "$(GCC_MD5)" ] || \
611
	[ "$$t1" = "$(GCC_MD5)" ] || \
603
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
612
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
604
	tar -jxf $< ;
613
	tar -jxf $< ;
605
	[ -d stamps ] || mkdir stamps ;
614
	[ -d stamps ] || mkdir stamps ;
606
	touch stamps/extract-gcc;
615
	touch stamps/extract-gcc;
607
616
608
.PHONY: patch-gcc patch-gcc-force
617
.PHONY: patch-gcc patch-gcc-force
609
patch-gcc: stamps/patch-gcc
618
patch-gcc: stamps/patch-gcc
610
patch-gcc-force stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches
619
patch-gcc-force stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches
611
	pushd gcc-$(GCC_VERSION) ; \
620
	pushd gcc-$(GCC_VERSION) ; \
612
	for f in ../source/avr32/gcc/*.patch; do \
621
	for f in ../source/avr32/gcc/*.patch; do \
613
	patch -N -p0 <$${f} ; \
622
	patch -N -p0 <$${f} ; \
614
	done ; \
623
	done ; \
615
	popd ;
624
	popd ;
616
	[ -d stamps ] || mkdir stamps
625
	[ -d stamps ] || mkdir stamps
617
	touch stamps/patch-gcc;
626
	touch stamps/patch-gcc;
618
627
619
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections			\
628
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections			\
620
-fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g	\
629
-fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g	\
621
-Os -fno-unroll-loops"
630
-Os -fno-unroll-loops"
622
631
623
.PHONY: build-gcc build-gcc-force
632
.PHONY: build-gcc build-gcc-force
624
build-gcc: stamps/build-gcc
633
build-gcc: stamps/build-gcc
625
build-gcc-force stamps/build-gcc: stamps/install-binutils stamps/patch-gcc
634
build-gcc-force stamps/build-gcc: stamps/install-binutils stamps/patch-gcc
626
	mkdir -p build/gcc && cd build/gcc && \
635
	mkdir -p build/gcc && cd build/gcc && \
627
	pushd ../../gcc-$(GCC_VERSION) ; \
636
	pushd ../../gcc-$(GCC_VERSION) ; \
628
	make clean ; \
637
	make clean ; \
629
	popd ; \
638
	popd ; \
630
	../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)"		\
639
	../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)"		\
631
	--target=$(TARGET) --enable-languages="c" --with-gnu-ld		\
640
	--target=$(TARGET) --enable-languages="c" --with-gnu-ld		\
632
	--with-gnu-as --with-newlib --disable-nls --disable-libssp	\
641
	--with-gnu-as --with-newlib --disable-nls --disable-libssp	\
633
	--with-dwarf2 --enable-sjlj-exceptions				\
642
	--with-dwarf2 --enable-sjlj-exceptions				\
634
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch	\
643
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch	\
635
	--disable-shared						\
644
	--disable-shared						\
636
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
645
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
637
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET)				\
646
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET)				\
638
	--with-sysroot="$(PREFIX)/$(TARGET)"				\
647
	--with-sysroot="$(PREFIX)/$(TARGET)"				\
639
	--with-build-sysroot="$(PREFIX)/$(TARGET)"			\
648
	--with-build-sysroot="$(PREFIX)/$(TARGET)"			\
640
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
649
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
641
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)				\
650
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)				\
642
	LDFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
651
	LDFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
643
	CPPFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
652
	CPPFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
644
	--with-bugurl=$(BUG_URL) \
653
	--with-bugurl=$(BUG_URL) \
645
	--with-pkgversion=$(PKG_VERSION) && \
654
	--with-pkgversion=$(PKG_VERSION) && \
646
	$(MAKE) -j$(PROCS)
655
	$(MAKE) -j$(PROCS)
647
	[ -d stamps ] || mkdir stamps
656
	[ -d stamps ] || mkdir stamps
648
	touch stamps/build-gcc;
657
	touch stamps/build-gcc;
649
658
650
.PHONY: install-gcc install-gcc-force
659
.PHONY: install-gcc install-gcc-force
651
install-gcc: stamps/install-gcc
660
install-gcc: stamps/install-gcc
652
install-gcc-force stamps/install-gcc: stamps/build-gcc
661
install-gcc-force stamps/install-gcc: stamps/build-gcc
653
	cd build/gcc && \
662
	cd build/gcc && \
654
	$(MAKE) installdirs install-target && \
663
	$(MAKE) installdirs install-target && \
655
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
664
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
656
	[ -d stamps ] || mkdir stamps
665
	[ -d stamps ] || mkdir stamps
657
	touch stamps/install-gcc;
666
	touch stamps/install-gcc;
658
667
659
.PHONY: clean-gcc
668
.PHONY: clean-gcc
660
clean-gcc:
669
clean-gcc:
661
	rm -rf build/gcc stamps/*-gcc gcc-*
670
	rm -rf build/gcc stamps/*-gcc gcc-*
662
671
663
.PHONY: realclean-gcc
672
.PHONY: realclean-gcc
664
realclean-gcc: clean-gcc
673
realclean-gcc: clean-gcc
665
	rm downloads/$(GCC_ARCHIVE)
674
	rm downloads/$(GCC_ARCHIVE)
666
675
667
676
668
################ Final GCC ################
677
################ Final GCC ################
669
678
670
.PHONY: build-final-gcc build-final-gcc-force
679
.PHONY: build-final-gcc build-final-gcc-force
671
build-final-gcc: stamps/build-final-gcc
680
build-final-gcc: stamps/build-final-gcc
672
build-final-gcc-force stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/patch-gcc
681
build-final-gcc-force stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/patch-gcc
673
	mkdir -p build/final-gcc && cd build/final-gcc && \
682
	mkdir -p build/final-gcc && cd build/final-gcc && \
674
	pushd ../../gcc-$(GCC_VERSION) ; \
683
	pushd ../../gcc-$(GCC_VERSION) ; \
675
	make clean ; \
684
	make clean ; \
676
	popd ; \
685
	popd ; \
677
	../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \
686
	../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \
678
	--target=$(TARGET) $(DEPENDENCIES) --enable-languages="c,c++" --with-gnu-ld \
687
	--target=$(TARGET) $(DEPENDENCIES) --enable-languages="c,c++" --with-gnu-ld \
679
	--with-gnu-as --with-newlib --disable-nls --disable-libssp \
688
	--with-gnu-as --with-newlib --disable-nls --disable-libssp \
680
	--with-dwarf2 --enable-sjlj-exceptions \
689
	--with-dwarf2 --enable-sjlj-exceptions \
681
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch \
690
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch \
682
	--disable-shared --enable-__cxa_atexit \
691
	--disable-shared --enable-__cxa_atexit \
683
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
692
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
684
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET) \
693
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET) \
685
	--with-sysroot=$(PREFIX)/$(TARGET) \
694
	--with-sysroot=$(PREFIX)/$(TARGET) \
686
	--with-build-sysroot=$(PREFIX)/$(TARGET) \
695
	--with-build-sysroot=$(PREFIX)/$(TARGET) \
687
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
696
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
688
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \
697
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \
689
	LDFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
698
	LDFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
690
	CPPFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
699
	CPPFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
691
	--with-bugurl=$(BUG_URL) \
700
	--with-bugurl=$(BUG_URL) \
692
	--with-pkgversion=$(PKG_VERSION) && \
701
	--with-pkgversion=$(PKG_VERSION) && \
693
	$(MAKE) -j$(PROCS)
702
	$(MAKE) -j$(PROCS)
694
	[ -d stamps ] || mkdir stamps
703
	[ -d stamps ] || mkdir stamps
695
	touch stamps/build-final-gcc;
704
	touch stamps/build-final-gcc;
696
705
697
.PHONY: install-final-gcc install-final-gcc-force
706
.PHONY: install-final-gcc install-final-gcc-force
698
install-final-gcc: stamps/install-final-gcc
707
install-final-gcc: stamps/install-final-gcc
699
install-final-gcc-force stamps/install-final-gcc: stamps/build-final-gcc
708
install-final-gcc-force stamps/install-final-gcc: stamps/build-final-gcc
700
	cd build/final-gcc && \
709
	cd build/final-gcc && \
701
	$(MAKE) installdirs install-target && \
710
	$(MAKE) installdirs install-target && \
702
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
711
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
703
	[ -d stamps ] || mkdir stamps
712
	[ -d stamps ] || mkdir stamps
704
	touch stamps/install-final-gcc;
713
	touch stamps/install-final-gcc;
705
714
706
.PHONY: clean-final-gcc
715
.PHONY: clean-final-gcc
707
clean-final-gcc: clean-gcc
716
clean-final-gcc: clean-gcc
708
	rm -rf build/final-gcc stamps/*-final-gcc
717
	rm -rf build/final-gcc stamps/*-final-gcc
709
718
710
.PHONY: realclean-final-gcc
719
.PHONY: realclean-final-gcc
711
realclean-final-gcc: realclean-gcc
720
realclean-final-gcc: realclean-gcc
712
721
713
722
714
########## GDB ###########
723
########## GDB ###########
715
724
716
.PHONY: download-gdb download-gdb-force
725
.PHONY: download-gdb download-gdb-force
717
download-gdb: downloads/$(GDB_ARCHIVE)
726
download-gdb: downloads/$(GDB_ARCHIVE)
718
download-gdb-force downloads/$(GDB_ARCHIVE):
727
download-gdb-force downloads/$(GDB_ARCHIVE):
719
	[ -d downloads ] || mkdir downloads ;
728
	[ -d downloads ] || mkdir downloads ;
720
	cd downloads && curl -LO $(GDB_URL)
729
	cd downloads && curl -LO $(GDB_URL)
721
730
722
.PHONY: extract-gdb extract-gdb-force
731
.PHONY: extract-gdb extract-gdb-force
723
extract-gdb: stamps/extract-gdb
732
extract-gdb: stamps/extract-gdb
724
extract-gdb-force stamps/extract-gdb: downloads/$(GDB_ARCHIVE)
733
extract-gdb-force stamps/extract-gdb: downloads/$(GDB_ARCHIVE)
725
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
734
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
726
	[ "$$t1" = "$(GDB_MD5)" ] || \
735
	[ "$$t1" = "$(GDB_MD5)" ] || \
727
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
736
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
728
	tar -jxf $< ;
737
	tar -jxf $< ;
729
	[ -d stamps ] || mkdir stamps ;
738
	[ -d stamps ] || mkdir stamps ;
730
	touch stamps/extract-gdb;
739
	touch stamps/extract-gdb;
731
740
732
.PHONY: patch-gdb patch-gdb-force
741
.PHONY: patch-gdb patch-gdb-force
733
patch-gdb: stamps/patch-gdb
742
patch-gdb: stamps/patch-gdb
734
patch-gdb-force stamps/patch-gdb: stamps/extract-gdb stamps/extract-avr32patches
743
patch-gdb-force stamps/patch-gdb: stamps/extract-gdb stamps/extract-avr32patches
735
	pushd gdb-$(GDB_VERSION) ; \
744
	pushd gdb-$(GDB_VERSION) ; \
736
	for f in ../source/avr32/gdb/*.patch; do \
745
	for f in ../source/avr32/gdb/*.patch; do \
737
	patch -N -p0 <$${f} ; \
746
	patch -N -p0 <$${f} ; \
738
	done ; \
747
	done ; \
739
	popd ; \
748
	popd ; \
740
	[ -d stamps ] || mkdir stamps
749
	[ -d stamps ] || mkdir stamps
741
	touch stamps/patch-gdb;
750
	touch stamps/patch-gdb;
742
751
743
.PHONY: regen-gdb regen-gdb-force
752
.PHONY: regen-gdb regen-gdb-force
744
regen-gdb: stamps/regen-gdb
753
regen-gdb: stamps/regen-gdb
745
regen-gdb-force stamps/regen-gdb: stamps/patch-gdb stamps/install-supp-tools
754
regen-gdb-force stamps/regen-gdb: stamps/patch-gdb stamps/install-supp-tools
746
	pushd gdb-$(GDB_VERSION) ; \
755
	pushd gdb-$(GDB_VERSION) ; \
747
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
756
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
748
	"$(SUPP_PREFIX)/bin/autoconf" ; \
757
	"$(SUPP_PREFIX)/bin/autoconf" ; \
749
	"$(SUPP_PREFIX)/bin/automake" ; \
758
	"$(SUPP_PREFIX)/bin/automake" ; \
750
	"$(SUPP_PREFIX)/bin/autoheader" ; \
759
	"$(SUPP_PREFIX)/bin/autoheader" ; \
751
	for dir in bfd opcodes gdb; do \
760
	for dir in bfd opcodes gdb; do \
752
	  pushd $$dir ; \
761
	  pushd $$dir ; \
753
	  echo "JESS 1: $$dir" >&2 ; \
762
	  echo "JESS 1: $$dir" >&2 ; \
754
	  "$(SUPP_PREFIX)/bin/autoconf"; \
763
	  "$(SUPP_PREFIX)/bin/autoconf"; \
755
	  "$(SUPP_PREFIX)/bin/automake"; \
764
	  "$(SUPP_PREFIX)/bin/automake"; \
756
	  "$(SUPP_PREFIX)/bin/autoheader"; \
765
	  "$(SUPP_PREFIX)/bin/autoheader"; \
757
	  echo "JESS 2: $$dir" >&2 ; \
766
	  echo "JESS 2: $$dir" >&2 ; \
758
	  popd ; \
767
	  popd ; \
759
	done; \
768
	done; \
760
	popd; \
769
	popd; \
761
	[ -d stamps ] || mkdir stamps ;
770
	[ -d stamps ] || mkdir stamps ;
762
	touch stamps/regen-gdb;
771
	touch stamps/regen-gdb;
763
772
764
.PHONY: build-gdb build-gdb-force
773
.PHONY: build-gdb build-gdb-force
765
build-gdb: stamps/build-gdb
774
build-gdb: stamps/build-gdb
766
build-gdb-force stamps/build-gdb: stamps/regen-gdb stamps/install-supp-tools
775
build-gdb-force stamps/build-gdb: stamps/regen-gdb stamps/install-supp-tools
767
	echo "JESS 3" >&2 ; \
776
	echo "JESS 3" >&2 ; \
768
	mkdir -p build/gdb && cd build/gdb && \
777
	mkdir -p build/gdb && cd build/gdb && \
769
	../../gdb-$(GDB_VERSION)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
778
	../../gdb-$(GDB_VERSION)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
770
	$(MAKE) -j$(PROCS)
779
	$(MAKE) -j$(PROCS)
771
	$(MAKE) installdirs install-host install-target
780
	$(MAKE) installdirs install-host install-target
772
	[ -d stamps ] || mkdir stamps
781
	[ -d stamps ] || mkdir stamps
773
	touch stamps/build-gdb;
782
	touch stamps/build-gdb;
774
783
775
.PHONY: install-gdb install-gdb-force
784
.PHONY: install-gdb install-gdb-force
776
install-gdb: stamps/install-gdb
785
install-gdb: stamps/install-gdb
777
install-gdb-force stamps/install-gdb: stamps/build-gdb
786
install-gdb-force stamps/install-gdb: stamps/build-gdb
778
	cd build/gdb && \
787
	cd build/gdb && \
779
	$(MAKE) install
788
	$(MAKE) install
780
	[ -d stamps ] || mkdir stamps
789
	[ -d stamps ] || mkdir stamps
781
	touch stamps/install-gdb;
790
	touch stamps/install-gdb;
782
791
783
.PHONY: clean-gdb
792
.PHONY: clean-gdb
784
clean-gdb:
793
clean-gdb:
785
	rm -rf build/gdb stamps/*-gdb gdb-*
794
	rm -rf build/gdb stamps/*-gdb gdb-*
786
795
787
.PHONY: realclean-gdb
796
.PHONY: realclean-gdb
788
realclean-gdb: clean-gdb
797
realclean-gdb: clean-gdb
789
	rm downloads/$(GDB_ARCHIVE)
798
	rm downloads/$(GDB_ARCHIVE)
790
799
791
################ NON-WORKING/NON-ADJUSTED TARGETS ################
800
################ NON-WORKING/NON-ADJUSTED TARGETS ################
792
801
793
802
794
gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/
803
gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/
795
	pushd gcc-$(GCC_VERSION)-$(CS_BASE) ; \
804
	pushd gcc-$(GCC_VERSION)-$(CS_BASE) ; \
796
	patch -N -p1 < ../patches/gcc-optsize.patch ; \
805
	patch -N -p1 < ../patches/gcc-optsize.patch ; \
797
	popd ;
806
	popd ;
798
807
799
gmp: gmp-$(CS_BASE)/ sudomode
808
gmp: gmp-$(CS_BASE)/ sudomode
800
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
809
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
801
	pushd ../../gmp-$(CS_BASE) ; \
810
	pushd ../../gmp-$(CS_BASE) ; \
802
	make clean ; \
811
	make clean ; \
803
	popd ; \
812
	popd ; \
804
	sudo -u $(SUDO_USER) ../../gmp-$(CS_BASE)/configure --disable-shared && \
813
	sudo -u $(SUDO_USER) ../../gmp-$(CS_BASE)/configure --disable-shared && \
805
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
814
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
806
	$(MAKE) install
815
	$(MAKE) install
807
816
808
mpc: mpc-$(MPC_VERSION)/ sudomode
817
mpc: mpc-$(MPC_VERSION)/ sudomode
809
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
818
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
810
	pushd ../../mpc-$(MPC_VERSION) ; \
819
	pushd ../../mpc-$(MPC_VERSION) ; \
811
	make clean ; \
820
	make clean ; \
812
	popd ; \
821
	popd ; \
813
	sudo -u $(SUDO_USER) ../../mpc-$(MPC_VERSION)/configure --disable-shared && \
822
	sudo -u $(SUDO_USER) ../../mpc-$(MPC_VERSION)/configure --disable-shared && \
814
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
823
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
815
	$(MAKE) install
824
	$(MAKE) install
816
825
817
mpc-$(MPC_VERSION) : $(LOCAL_BASE)/mpc-$(CS_VERSION).tar.bz2
826
mpc-$(MPC_VERSION) : $(LOCAL_BASE)/mpc-$(CS_VERSION).tar.bz2
818
ifeq ($(USER),root)
827
ifeq ($(USER),root)
819
	sudo -u $(SUDO_USER) tar -jxf $<
828
	sudo -u $(SUDO_USER) tar -jxf $<
820
else
829
else
821
	tar -jxf $<
830
	tar -jxf $<
822
endif
831
endif
823
832
824
mpfr: gmp mpfr-$(CS_BASE)/ sudomode
833
mpfr: gmp mpfr-$(CS_BASE)/ sudomode
825
	sudo -u $(SUDO_USER) mkdir -p build/mpfr && cd build/mpfr && \
834
	sudo -u $(SUDO_USER) mkdir -p build/mpfr && cd build/mpfr && \
826
	pushd ../../mpfr-$(CS_BASE) ; \
835
	pushd ../../mpfr-$(CS_BASE) ; \
827
	make clean ; \
836
	make clean ; \
828
	popd ; \
837
	popd ; \
829
	sudo -u $(SUDO_USER) ../../mpfr-$(CS_BASE)/configure LDFLAGS="-Wl,-search_paths_first" --disable-shared && \
838
	sudo -u $(SUDO_USER) ../../mpfr-$(CS_BASE)/configure LDFLAGS="-Wl,-search_paths_first" --disable-shared && \
830
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
839
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
831
	$(MAKE) install
840
	$(MAKE) install
832
841
833
cross-gdb: gdb-$(CS_BASE)/
842
cross-gdb: gdb-$(CS_BASE)/
834
	mkdir -p build/gdb && cd build/gdb && \
843
	mkdir -p build/gdb && cd build/gdb && \
835
	pushd ../../gdb-$(CS_BASE) ; \
844
	pushd ../../gdb-$(CS_BASE) ; \
836
	make clean ; \
845
	make clean ; \
837
	popd ; \
846
	popd ; \
838
	../../gdb-$(CS_BASE)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
847
	../../gdb-$(CS_BASE)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
839
	$(MAKE) -j$(PROCS) && \
848
	$(MAKE) -j$(PROCS) && \
840
	$(MAKE) installdirs install-host install-target && \
849
	$(MAKE) installdirs install-host install-target && \
841
	mkdir -p "$(PREFIX)/man/man1" && \
850
	mkdir -p "$(PREFIX)/man/man1" && \
842
	cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1"
851
	cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1"
843
852
844
.PHONY : clean
853
.PHONY : clean
845
clean:
854
clean:
846
	rm -rf build *-$(CS_BASE) binutils-* gcc-* gdb-* newlib-* mpc-* $(LOCAL_BASE) dfu-programmer-* autoconf-* automake-* stamps/* source supp
855
	rm -rf build *-$(CS_BASE) binutils-* gcc-* gdb-* newlib-* mpc-* $(LOCAL_BASE) dfu-programmer-* autoconf-* automake-* stamps/* source supp