Subversion Repositories avr32-toolchain

Rev

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

Rev 13 Rev 15
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
BUILD_DIR := $(CURDIR)/build
73
BUILD_DIR := $(CURDIR)/build
74
74
75
ifeq ($(strip $(BUG_URL)),)
75
ifeq ($(strip $(BUG_URL)),)
76
BUG_URL = https://github.com/jsnyder/avr32-toolchain
76
BUG_URL = https://github.com/jsnyder/avr32-toolchain
77
endif
77
endif
78
PKG_VERSION = "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)"
78
PKG_VERSION = "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)"
79
79
80
80
81
#### PRIMARY TOOLCHAIN URLS #####
81
#### PRIMARY TOOLCHAIN URLS #####
82
82
83
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
83
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
84
GCC_URL = http://mirror.anl.gov/pub/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE)
84
GCC_URL = http://mirror.anl.gov/pub/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE)
85
GCC_MD5 = fe1ca818fc6d2caeffc9051fe67ff103
85
GCC_MD5 = fe1ca818fc6d2caeffc9051fe67ff103
86
86
87
GDB_ARCHIVE = gdb-$(GDB_VERSION_DLOAD).tar.bz2
87
GDB_ARCHIVE = gdb-$(GDB_VERSION_DLOAD).tar.bz2
88
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
88
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
89
GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214
89
GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214
90
90
91
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
91
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
92
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
92
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
93
BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
93
BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
94
94
95
NEWLIB_ARCHIVE = newlib-$(NEWLIB_VERSION).tar.gz
95
NEWLIB_ARCHIVE = newlib-$(NEWLIB_VERSION).tar.gz
96
NEWLIB_URL = ftp://sources.redhat.com/pub/newlib/$(NEWLIB_ARCHIVE)
96
NEWLIB_URL = ftp://sources.redhat.com/pub/newlib/$(NEWLIB_ARCHIVE)
97
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
97
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
98
98
99
AVR32PATCHES_ARCHIVE = avr32-gnu-toolchain-$(AVR_PATCH_REV)-source.zip
99
AVR32PATCHES_ARCHIVE = avr32-gnu-toolchain-$(AVR_PATCH_REV)-source.zip
100
AVR32PATCHES_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32PATCHES_ARCHIVE)
100
AVR32PATCHES_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32PATCHES_ARCHIVE)
101
AVR32PATCHES_MD5 = 69a03828a328068f25d457cfd8341857
101
AVR32PATCHES_MD5 = 69a03828a328068f25d457cfd8341857
-
 
102
install_dir_avr32patches := source/avr32
102
103
103
AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip
104
AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip
104
AVR32HEADERS_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32HEADERS_ARCHIVE)
105
AVR32HEADERS_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32HEADERS_ARCHIVE)
105
AVR32HEADERS_MD5 = 3293d70a46e460d342e1f939b8e0d228
106
AVR32HEADERS_MD5 = 3293d70a46e460d342e1f939b8e0d228
106
107
107
DFU_ARCHIVE = dfu-programmer-$(DFU_VERSION).tar.gz
108
DFU_ARCHIVE = dfu-programmer-$(DFU_VERSION).tar.gz
108
DFU_URL = http://surfnet.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/$(DFU_VERSION)/$(DFU_ARCHIVE)
109
DFU_URL = http://surfnet.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/$(DFU_VERSION)/$(DFU_ARCHIVE)
109
DFU_MD5 = 707dcd0f957a74e92456ea6919faa772
110
DFU_MD5 = 707dcd0f957a74e92456ea6919faa772
110
111
111
112
112
##### SUPPORT TOOLS VERSIONS / URLS ######
113
##### SUPPORT TOOLS VERSIONS / URLS ######
113
AUTOCONF_VERSION = 2.64
114
AUTOCONF_VERSION = 2.64
114
AUTOMAKE_VERSION = 1.11
115
AUTOMAKE_VERSION = 1.11
115
MPC_VERSION = 0.8.1
116
MPC_VERSION = 0.8.1
116
117
117
AUTOCONF_ARCHIVE = autoconf-$(AUTOCONF_VERSION).tar.bz2
118
AUTOCONF_ARCHIVE = autoconf-$(AUTOCONF_VERSION).tar.bz2
118
AUTOCONF_URL = http://mirror.anl.gov/pub/gnu/autoconf/$(AUTOCONF_ARCHIVE)
119
AUTOCONF_URL = http://mirror.anl.gov/pub/gnu/autoconf/$(AUTOCONF_ARCHIVE)
119
AUTOCONF_MD5 = ef400d672005e0be21e0d20648169074
120
AUTOCONF_MD5 = ef400d672005e0be21e0d20648169074
120
121
121
AUTOMAKE_ARCHIVE = automake-$(AUTOMAKE_VERSION).tar.bz2
122
AUTOMAKE_ARCHIVE = automake-$(AUTOMAKE_VERSION).tar.bz2
122
AUTOMAKE_URL = http://mirror.anl.gov/pub/gnu/automake/$(AUTOMAKE_ARCHIVE)
123
AUTOMAKE_URL = http://mirror.anl.gov/pub/gnu/automake/$(AUTOMAKE_ARCHIVE)
123
AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
124
AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
124
125
125
126
126
ALL_TOOLS := gcc gdb binutils newlib avr32patches avr32headers dfu autoconf automake
127
ALL_TOOLS := gcc gdb binutils newlib avr32patches avr32headers dfu autoconf automake
127
128
128
129
129
130
130
.PHONY: install-tools
131
.PHONY: install-tools
131
install-tools: install-binutils install-final-gcc install-newlib install-headers
132
install-tools: install-binutils install-final-gcc install-newlib install-headers
132
133
133
.PHONY: install-cross
134
.PHONY: install-cross
134
install-cross: install-tools install-note
135
install-cross: install-tools install-note
135
136
136
137
137
.PHONY: sudomode
138
.PHONY: sudomode
138
sudomode:
139
sudomode:
139
ifneq ($(USER),root)
140
ifneq ($(USER),root)
140
	@echo Please run this target with sudo!
141
	@echo Please run this target with sudo!
141
	@echo e.g.: sudo make targetname
142
	@echo e.g.: sudo make targetname
142
	@exit 1
143
	@exit 1
143
endif
144
endif
144
145
145
146
146
.PHONY: tst
147
.PHONY: tst
147
tst:
148
tst:
148
	@echo "PREFIX=$(PREFIX)"
149
	@echo "PREFIX=$(PREFIX)"
149
	@echo "PKG_VERSION=$(PKG_VERSION)"
150
	@echo "PKG_VERSION=$(PKG_VERSION)"
150
	@echo "BUG_URL=$(BUG_URL)"
151
	@echo "BUG_URL=$(BUG_URL)"
151
152
152
153
153
############ MACROS for the lazy people ;-) ############
154
############ MACROS for the lazy people ;-) ############
154
155
155
## in silent mode (make -s),, print whats ging on
156
## in silent mode (make -s),, print whats ging on
156
ifeq ($(strip $(MAKEFLAGS)),s)
157
ifeq ($(strip $(MAKEFLAGS)),s)
157
define quiet_text
158
define quiet_text
158
	@echo "$1"
159
	@echo "$1"
159
endef
160
endef
160
else
161
else
161
define quiet_text
162
define quiet_text
162
endef
163
endef
163
endif
164
endif
164
165
165
## the stamp name
166
## the stamp name
166
define name_stamp
167
define name_stamp
167
$(STAMP_DIR)/$(1)
168
$(STAMP_DIR)/$(1)
168
endef
169
endef
169
170
170
## remove a stamp
171
## remove a stamp
171
define rm_stamp
172
define rm_stamp
172
	rm -f $(STAMP_DIR)/$(1)
173
	rm -f $(STAMP_DIR)/$(1)
173
endef
174
endef
174
175
175
## remove all stamps
176
## remove all stamps
176
define rm_stamps
177
define rm_stamps
177
	rm -f $(STAMP_DIR)/*-$(1)
178
	rm -f $(STAMP_DIR)/*-$(1)
178
endef
179
endef
179
180
180
## create the stamp directory if not existing and the stamp
181
## create the stamp directory if not existing and the stamp
181
define make_stamp
182
define make_stamp
182
	@[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR)
183
	@[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR)
183
	date > $(STAMP_DIR)/$(1)
184
	date > $(STAMP_DIR)/$(1)
184
endef
185
endef
185
186
186
## delete the given directory, if it is empty
187
## delete empty directories
187
define del_all_empty-directories
188
define del_empty-directories
188
	@find . -type d -empty | xargs rm -rf
189
	@find . -type d -empty | xargs rm -rf
189
endef
190
endef
190
191
-
 
192
## delete all empty directories
-
 
193
## need to do this several times. to remove empty sub directories
-
 
194
define del_all_empty-directories
-
 
195
	$(call del_empty-directories)
-
 
196
	$(call del_empty-directories)
-
 
197
	$(call del_empty-directories)
-
 
198
endef
-
 
199
-
 
200
191
## to make the following macros more simply, we need the variables
201
## to make the following macros more simply, we need the variables
192
## with the tool name in lowercase. I could have changed the original
202
## with the tool name in lowercase. I could have changed the original
193
## definition, but I don't want to break the make convention of upper
203
## definition, but I don't want to break the make convention of upper
194
## case definitions for such user defined variables.
204
## case definitions for such user defined variables.
195
205
196
define LOWER_TOOL_VARS
206
define LOWER_TOOL_VARS
197
UP_$(1) := $(shell echo "$(1)" | tr '[a-z]' '[A-Z]')
207
UP_$(1) := $(shell echo "$(1)" | tr '[a-z]' '[A-Z]')
198
$(1)_VERSION := $$($$(UP_$(1))_VERSION)
208
$(1)_VERSION := $$($$(UP_$(1))_VERSION)
199
$(1)_ARCHIVE := $$($$(UP_$(1))_ARCHIVE)
209
$(1)_ARCHIVE := $$($$(UP_$(1))_ARCHIVE)
200
$(1)_URL := $$($$(UP_$(1))_URL)
210
$(1)_URL := $$($$(UP_$(1))_URL)
201
$(1)_MD5 := $$($$(UP_$(1))_MD5)
211
$(1)_MD5 := $$($$(UP_$(1))_MD5)
202
endef
212
endef
203
213
204
$(foreach tool,$(ALL_TOOLS),$(eval $(call LOWER_TOOL_VARS,$(tool))))
214
$(foreach tool,$(ALL_TOOLS),$(eval $(call LOWER_TOOL_VARS,$(tool))))
205
215
206
216
207
## create the download rule and force download rule
217
## create the download rule and force download rule
208
define DOWNLOAD_template
218
define DOWNLOAD_template
209
download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
219
download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
210
download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE): $(DOWNLOAD_DIR)
220
download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE):
-
 
221
	[ -d $(DOWNLOAD_DIR) ] || mkdir -p $(DOWNLOAD_DIR)
211
	cd $(DOWNLOAD_DIR) && curl -LO $$($(1)_URL)
222
	cd $(DOWNLOAD_DIR) && curl -LO $$($(1)_URL)
212
223
213
download-$(1)_TEXT := "Removing $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)"
224
download-$(1)_TEXT := "Removing $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)"
214
download-$(1)-remove:
225
download-$(1)-remove:
215
	$(call quiet_text,$$(download-$(1)_TEXT))
226
	$(call quiet_text,$$(download-$(1)_TEXT))
216
	rm -f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
227
	rm -f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
217
228
218
PHONY += download-$(1) download-$(1)-f download-$(1)-remove
229
PHONY += download-$(1) download-$(1)-f download-$(1)-remove
219
endef
230
endef
220
231
221
## extract commands
232
## extract commands
222
EXT_BZ2 := tar -jxf
233
EXT_BZ2 := tar -jxf
223
EXT_TGZ := tar -xf
234
EXT_TGZ := tar -xf
224
EXT_ZIP := unzip -o
235
EXT_ZIP := unzip -o
225
236
226
## create the extract rule and force extract rule
237
## create the extract rule and force extract rule
227
define EXTRACT_template
238
define EXTRACT_template
228
extract-$(1)_TEXT := "Extracting $$($(1)_ARCHIVE)"
239
extract-$(1)_TEXT := "Extracting $$($(1)_ARCHIVE)"
229
240
230
extract-$(1): $(STAMP_DIR)/extract-$(1)
241
extract-$(1): $(STAMP_DIR)/extract-$(1)
231
extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
242
extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
232
	@(rm -rf $(1)-*; \
243
	@(rm -rf $(1)-*; \
233
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
244
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
234
	[ "$$$$t1" = "$$($(1)_MD5)" ] || \
245
	[ "$$$$t1" = "$$($(1)_MD5)" ] || \
235
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
246
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
236
	$(call quiet_text,$$(extract-$(1)_TEXT))
247
	$(call quiet_text,$$(extract-$(1)_TEXT))
237
	$($(2)) $$<
248
	$($(2)) $$< $(3)
238
	$(call make_stamp,extract-$(1))
249
	$(call make_stamp,extract-$(1))
239
250
240
extract-$(1)-remove:
251
extract-$(1)-remove:
241
	rm -rf $(1)-*
252
	rm -rf $(1)-*
242
	$(call rm_stamp,extract-$(1))
253
	$(call rm_stamp,extract-$(1))
243
254
244
PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove
255
PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove
245
endef
256
endef
246
257
-
 
258
## create the patch rule
-
 
259
define PATCH_template
-
 
260
patch-$(1)_TEXT := "Patching $$($(1)_ARCHIVE)"
-
 
261
patch-$(1): $(STAMP_DIR)/patch-$(1)
-
 
262
$(STAMP_DIR)/patch-$(1): $(STAMP_DIR)/extract-$(1) $(STAMP_DIR)/extract-avr32patches
-
 
263
	$(call quiet_text,$$(patch-$(1)_TEXT))
-
 
264
	@(pushd $(1)-$$($(1)_VERSION) ; \
-
 
265
	for f in ../$(install_dir_avr32patches)/$(1)/*.patch; do \
-
 
266
	patch -N -p0 < $$$${f} ; \
-
 
267
	done ; \
-
 
268
	popd)
-
 
269
	$(call make_stamp,patch-$(1))
-
 
270
-
 
271
patch-$(1)-remove: extract-$(1)-remove
-
 
272
	$(call rm_stamp,patch-$(1))
-
 
273
-
 
274
PHONY += patch-$(1) patch-$(1)-remove
-
 
275
endef
-
 
276
-
 
277
-
 
278
#.PHONY: regen-binutils regen-binutils-force
-
 
279
#regen-binutils: stamps/regen-binutils
-
 
280
#regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
-
 
281
#	pushd binutils-$(BINUTILS_VERSION) ; \
-
 
282
#	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
-
 
283
#	"$(SUPP_PREFIX)/bin/autoconf" ; \
-
 
284
#	"$(SUPP_PREFIX)/bin/automake" ; \
-
 
285
#	"$(SUPP_PREFIX)/bin/autoheader" ; \
-
 
286
#	for dir in bfd opcodes binutils gas ld; do \
-
 
287
#	  pushd $$dir ; \
-
 
288
#	  "$(SUPP_PREFIX)/bin/autoconf"; \
-
 
289
#	  "$(SUPP_PREFIX)/bin/automake"; \
-
 
290
#	  "$(SUPP_PREFIX)/bin/autoheader"; \
-
 
291
#	  popd ; \
-
 
292
#	done; \
-
 
293
#	popd; \
-
 
294
#	[ -d stamps ] || mkdir stamps ;
-
 
295
#	touch stamps/regen-binutils;
-
 
296
-
 
297
247
## create the configure rule and force configure rule
298
## create the configure rule and force configure rule
248
define CONF_template
299
define CONF_template
249
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)"
300
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)"
250
conf-$(1): $(STAMP_DIR)/conf-$(1)
301
conf-$(1): $(STAMP_DIR)/conf-$(1)
251
conf-$(1)-f $(STAMP_DIR)/conf-$(1): $(STAMP_DIR)/$(2)-$(1) $(BUILD_DIR)/$(1)
302
conf-$(1)-f $(STAMP_DIR)/conf-$(1): $(STAMP_DIR)/$(2)-$(1) $(BUILD_DIR)/$(1)
252
	@rm -rf $(BUILD_DIR)/$(1)/*
303
	@rm -rf $(BUILD_DIR)/$(1)/*
253
	$(call quiet_text,$$(conf-$(1)_TEXT))
304
	$(call quiet_text,$$(conf-$(1)_TEXT))
254
	cd $(BUILD_DIR)/$(1) && \
305
	cd $(BUILD_DIR)/$(1) && \
255
	../../$(1)-$$($(1)_VERSION)/configure $$($(1)_conf_opts)
306
	../../$(1)-$$($(1)_VERSION)/configure $$($(1)_conf_opts)
256
	$(call make_stamp,conf-$(1))
307
	$(call make_stamp,conf-$(1))
257
308
258
conf-$(1)-remove:
309
conf-$(1)-remove:
259
	$(call rm_stamp,conf-$(1))
310
	$(call rm_stamp,conf-$(1))
260
311
261
PHONY += conf-$(1) conf-$(1)-f conf-$(1)-remove
312
PHONY += conf-$(1) conf-$(1)-f conf-$(1)-remove
262
endef
313
endef
263
314
264
## create the build rule and force build rule
315
## create the build rule and force build rule
265
define BUILD_template
316
define BUILD_template
266
build-$(1)_TEXT := "Building $(1) $$($(1)_VERSION)"
317
build-$(1)_TEXT := "Building $(1) $$($(1)_VERSION)"
267
build-$(1): $(STAMP_DIR)/build-$(1)
318
build-$(1): $(STAMP_DIR)/build-$(1)
268
build-$(1)-f $(STAMP_DIR)/build-$(1): $(STAMP_DIR)/conf-$(1)
319
build-$(1)-f $(STAMP_DIR)/build-$(1): $(STAMP_DIR)/conf-$(1)
269
	$(call quiet_text,$$(build-$(1)_TEXT))
320
	$(call quiet_text,$$(build-$(1)_TEXT))
270
	cd $(BUILD_DIR)/$(1) && \
321
	cd $(BUILD_DIR)/$(1) && \
271
	$(MAKE) clean && $(MAKE) -j$(PROCS)
322
	$(MAKE) clean && $(MAKE) -j$(PROCS)
272
	$(call make_stamp,build-$(1))
323
	$(call make_stamp,build-$(1))
273
324
274
build-$(1)-remove:
325
build-$(1)-remove:
275
	rm -rf $(BUILD_DIR)/$(1)
326
	rm -rf $(BUILD_DIR)/$(1)
276
	$(call rm_stamp,build-$(1))
327
	$(call rm_stamp,build-$(1))
277
328
278
PHONY += build-$(1) build-$(1)-f build-$(1)-remove
329
PHONY += build-$(1) build-$(1)-f build-$(1)-remove
279
endef
330
endef
280
331
281
## create the install rule and force install rule
332
## create the install rule and force install rule
282
define INSTALL_template
333
define INSTALL_template
283
install-$(1)_TEXT := "Installing $(1) $$($(1)_VERSION)"
334
install-$(1)_TEXT := "Installing $(1) $$($(1)_VERSION)"
284
install-$(1): $(STAMP_DIR)/install-$(1)
335
install-$(1): $(STAMP_DIR)/install-$(1)
285
install-$(1)-f $(STAMP_DIR)/install-$(1): $(STAMP_DIR)/build-$(1)
336
install-$(1)-f $(STAMP_DIR)/install-$(1): $(STAMP_DIR)/build-$(1)
286
	$(call quiet_text,$$(install-$(1)_TEXT))
337
	$(call quiet_text,$$(install-$(1)_TEXT))
287
	cd $(BUILD_DIR)/$(1) && \
338
	cd $(BUILD_DIR)/$(1) && \
288
	$(MAKE) install
339
	$(MAKE) install
289
	$(call make_stamp,install-$(1))
340
	$(call make_stamp,install-$(1))
290
341
291
uninstall-$(1)_TEXT := "Uninstalling $(1) $$($(1)_VERSION)"
342
uninstall-$(1)_TEXT := "Uninstalling $(1) $$($(1)_VERSION)"
292
uninstall-$(1):
343
uninstall-$(1):
293
	$(call quiet_text,$$(uninstall-$(1)_TEXT))
344
	$(call quiet_text,$$(uninstall-$(1)_TEXT))
294
	[ -f $(BUILD_DIR)/$(1)/Makefile ] && \
345
	[ -f $(BUILD_DIR)/$(1)/Makefile ] && \
295
	[ -f $(call name_stamp,install-$(1)) ] && \
346
	[ -f $(call name_stamp,install-$(1)) ] && \
296
	cd $(BUILD_DIR)/$(1) && \
347
	cd $(BUILD_DIR)/$(1) && \
297
	$(MAKE) uninstall || true
348
	$(MAKE) uninstall || true
298
	$(call rm_stamp,install-$(1))
349
	$(call rm_stamp,install-$(1))
299
350
300
PHONY += install-$(1) install-$(1)-f uninstall-$(1)
351
PHONY += install-$(1) install-$(1)-f uninstall-$(1)
301
endef
352
endef
302
353
303
## create the clean rule and realclean rule
354
## create the clean rule and realclean rule
304
define CLEAN_template
355
define CLEAN_template
305
clean-$(1)_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
356
clean-$(1)_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
306
clean-$(1)-text:
357
clean-$(1)-text:
307
	$(call quiet_text,$$(clean-$(1)_TEXT))
358
	$(call quiet_text,$$(clean-$(1)_TEXT))
308
359
309
clean-$(1): clean-$(1)-text uninstall-$(1) extract-$(1)-remove build-$(1)-remove conf-$(1)-remove
360
clean-$(1): clean-$(1)-text uninstall-$(1) extract-$(1)-remove patch-$(1)-remove \
310
	$(call del_all_empty-directories)
-
 
311
	$(call del_all_empty-directories)
361
            build-$(1)-remove conf-$(1)-remove
312
	$(call del_all_empty-directories)
362
	$(call del_all_empty-directories)
313
363
314
realclean-$(1): clean-$(1) download-$(1)-remove
364
realclean-$(1): clean-$(1) download-$(1)-remove
315
	$(call del_all_empty-directories)
365
	$(call del_all_empty-directories)
316
	$(call del_all_empty-directories)
-
 
317
	$(call del_all_empty-directories)
-
 
318
366
319
PHONY += clean-$(1) realclean-$(1) clean-$(1)-text
367
PHONY += clean-$(1) realclean-$(1) clean-$(1)-text
320
endef
368
endef
321
369
-
 
370
## create some dummy rules for the clean rule
-
 
371
define DUMMY_patch_remove
-
 
372
patch-$(1)-remove:
-
 
373
PHONY += patch-$(1)-remove
-
 
374
endef
-
 
375
define DUMMY_conf_remove
-
 
376
conf-$(1)-remove:
-
 
377
PHONY += conf-$(1)-remove
-
 
378
endef
-
 
379
define DUMMY_build_remove
-
 
380
build-$(1)-remove:
-
 
381
PHONY += build-$(1)-remove
-
 
382
endef
322
383
323
384
324
-
 
325
$(DOWNLOAD_DIR):
-
 
326
	mkdir -p $@
-
 
327
-
 
328
$(BUILD_DIR)/%:
385
$(BUILD_DIR)/%:
329
	mkdir -p $@
386
	mkdir -p $@
330
387
331
388
332
############# SUPP: AUTOCONF ############
389
############# SUPP: AUTOCONF ############
333
390
334
$(eval $(call DOWNLOAD_template,autoconf))
391
$(eval $(call DOWNLOAD_template,autoconf))
335
$(eval $(call EXTRACT_template,autoconf,EXT_BZ2))
392
$(eval $(call EXTRACT_template,autoconf,EXT_BZ2))
336
autoconf_conf_opts = --prefix="$(SUPP_PREFIX)"
393
autoconf_conf_opts = --prefix="$(SUPP_PREFIX)"
337
$(eval $(call CONF_template,autoconf,extract))
394
$(eval $(call CONF_template,autoconf,extract))
338
$(eval $(call BUILD_template,autoconf))
395
$(eval $(call BUILD_template,autoconf))
339
$(eval $(call INSTALL_template,autoconf))
396
$(eval $(call INSTALL_template,autoconf))
340
$(eval $(call CLEAN_template,autoconf))
397
$(eval $(call CLEAN_template,autoconf))
341
398
342
399
343
############ SUPP: AUTOMAKE ############
400
############ SUPP: AUTOMAKE ############
344
401
345
$(eval $(call DOWNLOAD_template,automake))
402
$(eval $(call DOWNLOAD_template,automake))
346
$(eval $(call EXTRACT_template,automake,EXT_BZ2))
403
$(eval $(call EXTRACT_template,automake,EXT_BZ2))
347
automake_conf_opts = --prefix="$(SUPP_PREFIX)"
404
automake_conf_opts = --prefix="$(SUPP_PREFIX)"
348
$(eval $(call CONF_template,automake,extract))
405
$(eval $(call CONF_template,automake,extract))
349
$(eval $(call BUILD_template,automake))
406
$(eval $(call BUILD_template,automake))
350
$(eval $(call INSTALL_template,automake))
407
$(eval $(call INSTALL_template,automake))
351
$(eval $(call CLEAN_template,automake))
408
$(eval $(call CLEAN_template,automake))
352
409
353
410
-
 
411
############# AVR32 PATCHES ############
-
 
412
-
 
413
$(eval $(call DOWNLOAD_template,avr32patches))
-
 
414
$(eval $(call EXTRACT_template,avr32patches,EXT_ZIP))
-
 
415
-
 
416
## use the uninstall-XXX rule to remove the patches directory
-
 
417
PHONY += uninstall-avr32patches
-
 
418
uninstall-avr32patches:
-
 
419
	rm -rf $(install_dir_avr32patches)
-
 
420
-
 
421
$(eval $(call CLEAN_template,avr32patches))
-
 
422
-
 
423
-
 
424
############# AVR32 HEADERS ############
-
 
425
$(eval $(call DOWNLOAD_template,avr32headers))
-
 
426
-
 
427
###### FIXME: Need to add a dependency to "stamps/install-final-gcc"
-
 
428
install_path_avr32headers := $(PREFIX)/$(TARGET)/include/
-
 
429
avr32headers_unzip_opt := -d "$(install_path_avr32headers)"
-
 
430
$(eval $(call EXTRACT_template,avr32headers,EXT_ZIP,$(avr32headers_unzip_opt)))
-
 
431
-
 
432
## use the uninstall-XXX rule to remove the patches directory
-
 
433
install_dir_avr32headers := $(install_path_avr32headers)/avr32
-
 
434
PHONY += uninstall-avr32headers
-
 
435
uninstall-avr32headers:
-
 
436
	rm -rf $(install_dir_avr32headers)
-
 
437
-
 
438
$(eval $(call CLEAN_template,avr32headers))
-
 
439
-
 
440
-
 
441
################ BINUTILS ################
-
 
442
-
 
443
$(eval $(call DOWNLOAD_template,binutils))
-
 
444
$(eval $(call EXTRACT_template,binutils,EXT_BZ2))
-
 
445
$(eval $(call PATCH_template,binutils))
-
 
446
#$(eval $(call REGEN_template,binutils))
-
 
447
binutils_conf_opts = \
-
 
448
--enable-maintainer-mode \
-
 
449
--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls \
-
 
450
--disable-shared --disable-werror \
-
 
451
--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL)
-
 
452
$(eval $(call CONF_template,binutils,extract))
-
 
453
$(eval $(call BUILD_template,binutils))
-
 
454
$(eval $(call INSTALL_template,binutils))
-
 
455
$(eval $(call CLEAN_template,binutils))
-
 
456
-
 
457
-
 
458
# we need to satisfy the rules, generated by the CLEAN_template, if they not exist
-
 
459
patch_remove_dummy_tools := autoconf automake avr32patches avr32headers
-
 
460
$(foreach tool,$(patch_remove_dummy_tools),$(eval $(call DUMMY_patch_remove,$(tool))))
-
 
461
conf_remove_dummy_tools := avr32patches avr32headers
-
 
462
$(foreach tool,$(conf_remove_dummy_tools),$(eval $(call DUMMY_conf_remove,$(tool))))
-
 
463
build_remove_dummy_tools := avr32patches avr32headers
-
 
464
$(foreach tool,$(build_remove_dummy_tools),$(eval $(call DUMMY_build_remove,$(tool))))
-
 
465
-
 
466
354
.PHONY: $(PHONY)
467
.PHONY: $(PHONY)
355
468
356
469
357
.PHONY: tst2 tst3
470
.PHONY: tst2 tst3
358
tst2:
471
tst2:
359
	$(call make_stamp,JES)
472
	$(call make_stamp,JES)
360
tst3:
473
tst3:
361
	$(call rm_stamp,JES)
474
	$(call rm_stamp,JES)
362
475
363
476
-
 
477
.PHONY: help
-
 
478
help:
-
 
479
	@echo ""
-
 
480
	@echo "The following targets are available:"
-
 
481
	@echo ""
-
 
482
	@echo "download-XXX	: download the required package"
-
 
483
	@echo "extract-XXX	: extract the downloaded package"
-
 
484
	@echo "conf-XXX	: configure the extracted package"
-
 
485
	@echo "build-XXX	: build the configured package"
-
 
486
	@echo "install-XXX	: install the build package"
-
 
487
	@echo "uninstall-XXX	: uninstall the installed package"
-
 
488
	@echo "clean-XXX	: clean the package source and build tree"
-
 
489
	@echo "realclean-XXX	: same as clean-XXX, but remove the downloaded"
-
 
490
	@echo "		  package, too"
-
 
491
	@echo ""
-
 
492
	@echo "XXX can be one of the following: "
-
 
493
	@echo "$(ALL_TOOLS)"
-
 
494
	@echo ""
-
 
495
	@echo "The above targets will be executed in the right order and only if"
-
 
496
	@echo "they need to be be really built. If you want to rebuild one of then"
-
 
497
	@echo "manualy, you can use the aaaa-XXX-f target (e.g.: build-autoconf-f,"
-
 
498
	@echo "download-automake-f). Please note, that not all steps are available for"
-
 
499
	@echo "all tools (e.g.: install-avr32patches is not available)."
-
 
500
	@echo ""
-
 
501
	@echo ""
-
 
502
-
 
503
364
.PHONY: install-note
504
.PHONY: install-note
365
install-note: install-tools
505
install-note: install-tools
366
	@echo
506
	@echo
367
	@echo ====== INSTALLATION NOTE ======
507
	@echo ====== INSTALLATION NOTE ======
368
	@echo Your tools have now been installed at the following prefix:
508
	@echo Your tools have now been installed at the following prefix:
369
	@echo $(PREFIX)
509
	@echo $(PREFIX)
370
	@echo
510
	@echo
371
	@echo Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:
511
	@echo Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:
372
	@echo export PATH=$(PREFIX)/bin:'$$PATH'
512
	@echo export PATH=$(PREFIX)/bin:'$$PATH'
373
513
374
514
375
.PHONY: install-supp-tools install-supp-tools-force
515
.PHONY: install-supp-tools install-supp-tools-force
376
install-supp-tools: stamps/install-supp-tools
516
install-supp-tools: stamps/install-supp-tools
377
install-supp-tools-force stamps/install-supp-tools: stamps/install-autoconf stamps/install-automake
517
install-supp-tools-force stamps/install-supp-tools: stamps/install-autoconf stamps/install-automake
378
	[ -d stamps ] || mkdir stamps ;
518
	[ -d stamps ] || mkdir stamps ;
379
	touch stamps/install-supp-tools;
519
	touch stamps/install-supp-tools;
380
520
381
.PHONY: clean-supp-tools
521
.PHONY: clean-supp-tools
382
clean-supp-tools: clean-autoconf clean-automake
522
clean-supp-tools: clean-autoconf clean-automake
383
	rm stamps/install-supp-tools;
523
	rm stamps/install-supp-tools;
384
524
385
.PHONY: realclean-supp-tools
525
.PHONY: realclean-supp-tools
386
realclean-supp-tools: realclean-autoconf realclean-automake
526
realclean-supp-tools: realclean-autoconf realclean-automake
387
	rm stamps/install-supp-tools;
527
	rm stamps/install-supp-tools;
388
528
389
529
390
530
391
531
392
532
393
############ SUPP: AUTOMAKE ############
533
############ SUPP: AUTOMAKE ############
394
534
395
##.PHONY: download-automake download-automake-force
535
##.PHONY: download-automake download-automake-force
396
##download-automake: downloads/$(AUTOMAKE_ARCHIVE)
536
##download-automake: downloads/$(AUTOMAKE_ARCHIVE)
397
##download-automake-force downloads/$(AUTOMAKE_ARCHIVE):
537
##download-automake-force downloads/$(AUTOMAKE_ARCHIVE):
398
##	[ -d downloads ] || mkdir downloads ;
538
##	[ -d downloads ] || mkdir downloads ;
399
##	cd downloads && curl -LO $(AUTOMAKE_URL)
539
##	cd downloads && curl -LO $(AUTOMAKE_URL)
400
540
401
##.PHONY: extract-automake extract-automake-force
541
##.PHONY: extract-automake extract-automake-force
402
##extract-automake: stamps/extract-automake
542
##extract-automake: stamps/extract-automake
403
##extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE)
543
##extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE)
404
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
544
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
405
##	[ "$$t1" = "$(AUTOMAKE_MD5)" ] || \
545
##	[ "$$t1" = "$(AUTOMAKE_MD5)" ] || \
406
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
546
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
407
##	tar -jxf $< ;
547
##	tar -jxf $< ;
408
##	[ -d stamps ] || mkdir stamps ;
548
##	[ -d stamps ] || mkdir stamps ;
409
##	touch stamps/extract-automake;
549
##	touch stamps/extract-automake;
410
550
411
##.PHONY: build-automake build-automake-force
551
##.PHONY: build-automake build-automake-force
412
##build-automake: stamps/build-automake
552
##build-automake: stamps/build-automake
413
##build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf
553
##build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf
414
##	mkdir -p build/automake && cd build/automake && \
554
##	mkdir -p build/automake && cd build/automake && \
415
##	../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
555
##	../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
416
##	$(MAKE) -j$(PROCS)
556
##	$(MAKE) -j$(PROCS)
417
##	[ -d stamps ] || mkdir stamps
557
##	[ -d stamps ] || mkdir stamps
418
##	touch stamps/build-automake;
558
##	touch stamps/build-automake;
419
559
420
##.PHONY: install-automake install-automake-force
560
##.PHONY: install-automake install-automake-force
421
##install-automake: stamps/install-automake
561
##install-automake: stamps/install-automake
422
##install-automake-force stamps/install-automake: stamps/build-automake
562
##install-automake-force stamps/install-automake: stamps/build-automake
423
##	cd build/automake && \
563
##	cd build/automake && \
424
##	$(MAKE) install
564
##	$(MAKE) install
425
##	[ -d stamps ] || mkdir stamps
565
##	[ -d stamps ] || mkdir stamps
426
##	touch stamps/install-automake;
566
##	touch stamps/install-automake;
427
567
428
##.PHONY: clean-automake
568
##.PHONY: clean-automake
429
##clean-automake:
569
##clean-automake:
430
##	rm -rf build/automake stamps/*-automake automake-*
570
##	rm -rf build/automake stamps/*-automake automake-*
431
571
432
##.PHONY: realclean-automake
572
##.PHONY: realclean-automake
433
##realclean-automake: clean-automake
573
##realclean-automake: clean-automake
434
##	rm downloads/$(AUTOMAKE_ARCHIVE)
574
##	rm downloads/$(AUTOMAKE_ARCHIVE)
435
575
436
576
437
############# AVR32 PATCHES ############
577
############# AVR32 PATCHES ############
438
578
439
.PHONY: download-avr32patches download-avr32patches-force
579
##.PHONY: download-avr32patches download-avr32patches-force
440
download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
580
##download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
441
download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE):
581
##download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE):
442
	cd downloads && curl -LO $(AVR32PATCHES_URL)
582
##	cd downloads && curl -LO $(AVR32PATCHES_URL)
443
583
444
.PHONY: extract-avr32patches extract-avr32patches-force
584
##.PHONY: extract-avr32patches extract-avr32patches-force
445
extract-avr32patches: stamps/extract-avr32patches
585
##extract-avr32patches: stamps/extract-avr32patches
446
extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
586
##extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
447
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
587
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
448
	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
588
##	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
449
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
589
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
450
	unzip -o $<
590
##	unzip -o $<
451
	[ -d stamps ] || mkdir stamps
591
##	[ -d stamps ] || mkdir stamps
452
	touch stamps/extract-avr32patches;
592
##	touch stamps/extract-avr32patches;
453
593
454
.PHONY: clean-avr32patches
594
##.PHONY: clean-avr32patches
455
clean-avr32patches:
595
##clean-avr32patches:
456
	rm -rf stamps/*-avr32patches source
596
##	rm -rf stamps/*-avr32patches source
457
597
458
.PHONY: realclean-avr32patches
598
##.PHONY: realclean-avr32patches
459
realclean-avr32patches: clean-avr32patches
599
##realclean-avr32patches: clean-avr32patches
460
	rm downloads/$(AVR32PATCHES_ARCHIVE)
600
##	rm downloads/$(AVR32PATCHES_ARCHIVE)
461
601
462
602
463
############# AVR32 HEADERS ############
603
############# AVR32 HEADERS ############
464
604
465
.PHONY: download-avr32headers download-avr32headers-force
605
##.PHONY: download-avr32headers download-avr32headers-force
466
download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE)
606
##download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE)
467
download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE):
607
##download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE):
468
	cd downloads && curl -LO $(AVR32HEADERS_URL)
608
##	cd downloads && curl -LO $(AVR32HEADERS_URL)
469
609
470
.PHONY: install-headers install-headers-force
610
##.PHONY: install-headers install-headers-force
471
install-headers: stamps/install-headers
611
##install-headers: stamps/install-headers
472
install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
612
##install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
473
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
613
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
474
	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
614
##	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
475
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
615
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
476
	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
616
##	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
477
	[ -d stamps ] || mkdir stamps
617
##	[ -d stamps ] || mkdir stamps
478
	touch stamps/install-headers;
618
##	touch stamps/install-headers;
479
619
480
.PHONY: clean-headers
620
##.PHONY: clean-headers
481
clean-headers:
621
##clean-headers:
482
	rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32
622
##	rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32
483
623
484
.PHONY: realclean-headers
624
##.PHONY: realclean-headers
485
realclean-headers: clean-headers
625
##realclean-headers: clean-headers
486
	rm downloads/$(AVR32HEADERS_ARCHIVE)
626
##	rm downloads/$(AVR32HEADERS_ARCHIVE)
487
627
488
628
489
################ NEWLIB ################
629
################ NEWLIB ################
490
630
491
.PHONY: download-newlib download-newlib-force
631
.PHONY: download-newlib download-newlib-force
492
download-newlib: downloads/$(NEWLIB_ARCHIVE)
632
download-newlib: downloads/$(NEWLIB_ARCHIVE)
493
download-newlib-force downloads/$(NEWLIB_ARCHIVE):
633
download-newlib-force downloads/$(NEWLIB_ARCHIVE):
494
	[ -d downloads ] || mkdir downloads ;
634
	[ -d downloads ] || mkdir downloads ;
495
	cd downloads && curl -LO $(NEWLIB_URL)
635
	cd downloads && curl -LO $(NEWLIB_URL)
496
636
497
.PHONY: extract-newlib extract-newlib-force
637
.PHONY: extract-newlib extract-newlib-force
498
extract-newlib: stamps/extract-newlib
638
extract-newlib: stamps/extract-newlib
499
extract-newlib-force stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE)
639
extract-newlib-force stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE)
500
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
640
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
501
	[ "$$t1" = "$(NEWLIB_MD5)" ] || \
641
	[ "$$t1" = "$(NEWLIB_MD5)" ] || \
502
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
642
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
503
	tar -xf $<
643
	tar -xf $<
504
	[ -d stamps ] || mkdir stamps
644
	[ -d stamps ] || mkdir stamps
505
	touch stamps/extract-newlib;
645
	touch stamps/extract-newlib;
506
646
507
647
508
.PHONY: patch-newlib patch-newlib-force
648
.PHONY: patch-newlib patch-newlib-force
509
patch-newlib: stamps/patch-newlib
649
patch-newlib: stamps/patch-newlib
510
patch-newlib-force stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches
650
patch-newlib-force stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches
511
	pushd newlib-$(NEWLIB_VERSION) ; \
651
	pushd newlib-$(NEWLIB_VERSION) ; \
512
	for f in ../source/avr32/newlib/*.patch; do \
652
	for f in ../source/avr32/newlib/*.patch; do \
513
	patch -N -p0 <$${f} ; \
653
	patch -N -p0 <$${f} ; \
514
	done ; \
654
	done ; \
515
	popd ;
655
	popd ;
516
	[ -d stamps ] || mkdir stamps
656
	[ -d stamps ] || mkdir stamps
517
	touch stamps/patch-newlib;
657
	touch stamps/patch-newlib;
518
658
519
.PHONY: regen-newlib regen-newlib-force
659
.PHONY: regen-newlib regen-newlib-force
520
regen-newlib: stamps/regen-newlib
660
regen-newlib: stamps/regen-newlib
521
regen-newlib-force stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools
661
regen-newlib-force stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools
522
	pushd newlib-$(NEWLIB_VERSION) ; \
662
	pushd newlib-$(NEWLIB_VERSION) ; \
523
	"$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \
663
	"$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \
524
	for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \
664
	for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \
525
	  pushd $$dir ; \
665
	  pushd $$dir ; \
526
	  "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \
666
	  "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \
527
	  "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake"; \
667
	  "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake"; \
528
	  popd ; \
668
	  popd ; \
529
	done; \
669
	done; \
530
	popd;
670
	popd;
531
	[ -d stamps ] || mkdir stamps
671
	[ -d stamps ] || mkdir stamps
532
	touch stamps/regen-newlib;
672
	touch stamps/regen-newlib;
533
673
534
NEWLIB_FLAGS="-ffunction-sections -fdata-sections	\
674
NEWLIB_FLAGS="-ffunction-sections -fdata-sections	\
535
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os	\
675
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os	\
536
-fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128	\
676
-fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128	\
537
-DSMALL_MEMORY"
677
-DSMALL_MEMORY"
538
678
539
.PHONY: build-newlib build-newlib-force
679
.PHONY: build-newlib build-newlib-force
540
build-newlib: stamps/build-newlib
680
build-newlib: stamps/build-newlib
541
build-newlib-force stamps/build-newlib: stamps/regen-newlib stamps/install-binutils stamps/install-gcc
681
build-newlib-force stamps/build-newlib: stamps/regen-newlib stamps/install-binutils stamps/install-gcc
542
	mkdir -p build/newlib && cd build/newlib && \
682
	mkdir -p build/newlib && cd build/newlib && \
543
	pushd ../../newlib-$(NEWLIB_VERSION) ; \
683
	pushd ../../newlib-$(NEWLIB_VERSION) ; \
544
	make clean ; \
684
	make clean ; \
545
	popd ; \
685
	popd ; \
546
	../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX)	\
686
	../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX)	\
547
	--with-build-time-tools=$(PREFIX)				\
687
	--with-build-time-tools=$(PREFIX)				\
548
	--target=$(TARGET) --disable-newlib-supplied-syscalls		\
688
	--target=$(TARGET) --disable-newlib-supplied-syscalls		\
549
	--disable-libgloss --disable-nls --disable-shared		\
689
	--disable-libgloss --disable-nls --disable-shared		\
550
	--enable-newlib-io-long-long --enable-newlib-io-long-double	\
690
	--enable-newlib-io-long-long --enable-newlib-io-long-double	\
551
	--enable-target-optspace --enable-newlib-io-pos-args		\
691
	--enable-target-optspace --enable-newlib-io-pos-args		\
552
	--enable-newlib-reent-small  && \
692
	--enable-newlib-reent-small  && \
553
	$(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \
693
	$(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \
554
	[ -d stamps ] || mkdir stamps
694
	[ -d stamps ] || mkdir stamps
555
	touch stamps/build-newlib;
695
	touch stamps/build-newlib;
556
696
557
.PHONY: install-newlib install-newlib-force
697
.PHONY: install-newlib install-newlib-force
558
install-newlib: stamps/install-newlib
698
install-newlib: stamps/install-newlib
559
install-newlib-force stamps/install-newlib: stamps/build-newlib
699
install-newlib-force stamps/install-newlib: stamps/build-newlib
560
	cd build/newlib && \
700
	cd build/newlib && \
561
	$(MAKE) install
701
	$(MAKE) install
562
	[ -d stamps ] || mkdir stamps
702
	[ -d stamps ] || mkdir stamps
563
	touch stamps/install-newlib;
703
	touch stamps/install-newlib;
564
704
565
.PHONY: clean-newlib
705
.PHONY: clean-newlib
566
clean-newlib:
706
clean-newlib:
567
	rm -rf build/newlib stamps/*-newlib newlib-*
707
	rm -rf build/newlib stamps/*-newlib newlib-*
568
708
569
.PHONY: realclean-newlib
709
.PHONY: realclean-newlib
570
realclean-newlib: clean-newlib
710
realclean-newlib: clean-newlib
571
	rm downloads/$(NEWLIB_ARCHIVE)
711
	rm downloads/$(NEWLIB_ARCHIVE)
572
712
573
713
574
################ BINUTILS ################
714
################ BINUTILS ################
575
715
576
.PHONY: download-binutils download-binutils-force
716
##.PHONY: download-binutils download-binutils-force
577
download-binutils: downloads/$(BINUTILS_ARCHIVE)
717
##download-binutils: downloads/$(BINUTILS_ARCHIVE)
578
download-binutils-force downloads/$(BINUTILS_ARCHIVE):
718
##download-binutils-force downloads/$(BINUTILS_ARCHIVE):
579
	[ -d downloads ] || mkdir downloads ;
719
##	[ -d downloads ] || mkdir downloads ;
580
	cd downloads && curl -LO $(BINUTILS_URL)
720
##	cd downloads && curl -LO $(BINUTILS_URL)
581
721
582
.PHONY: extract-binutils extract-binutils-force
722
##.PHONY: extract-binutils extract-binutils-force
583
extract-binutils: stamps/extract-binutils
723
##extract-binutils: stamps/extract-binutils
584
extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
724
##extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
585
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
725
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
586
	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
726
##	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
587
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
727
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
588
	tar -jxf $< ;
728
##	tar -jxf $< ;
589
	[ -d stamps ] || mkdir stamps ;
729
##	[ -d stamps ] || mkdir stamps ;
590
	touch stamps/extract-binutils;
730
##	touch stamps/extract-binutils;
591
731
592
.PHONY: patch-binutils patch-binutils-force
732
##.PHONY: patch-binutils patch-binutils-force
593
patch-binutils: stamps/patch-binutils
733
##patch-binutils: stamps/patch-binutils
594
patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
734
##patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
595
	pushd binutils-$(BINUTILS_VERSION) ; \
735
##	pushd binutils-$(BINUTILS_VERSION) ; \
596
	for f in ../source/avr32/binutils/*.patch; do \
736
##	for f in ../source/avr32/binutils/*.patch; do \
597
	patch -N -p0 <$${f} ; \
737
##	patch -N -p0 <$${f} ; \
598
	done ; \
738
##	done ; \
599
	popd ; \
739
##	popd ; \
600
	[ -d stamps ] || mkdir stamps
740
##	[ -d stamps ] || mkdir stamps
601
	touch stamps/patch-binutils;
741
##	touch stamps/patch-binutils;
602
742
603
.PHONY: regen-binutils regen-binutils-force
743
##.PHONY: regen-binutils regen-binutils-force
604
regen-binutils: stamps/regen-binutils
744
##regen-binutils: stamps/regen-binutils
605
regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
745
##regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
606
	pushd binutils-$(BINUTILS_VERSION) ; \
746
##	pushd binutils-$(BINUTILS_VERSION) ; \
607
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
747
##	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
608
	"$(SUPP_PREFIX)/bin/autoconf" ; \
748
##	"$(SUPP_PREFIX)/bin/autoconf" ; \
609
	"$(SUPP_PREFIX)/bin/automake" ; \
749
##	"$(SUPP_PREFIX)/bin/automake" ; \
610
	"$(SUPP_PREFIX)/bin/autoheader" ; \
750
##	"$(SUPP_PREFIX)/bin/autoheader" ; \
611
	for dir in bfd opcodes binutils gas ld; do \
751
##	for dir in bfd opcodes binutils gas ld; do \
612
	  pushd $$dir ; \
752
##	  pushd $$dir ; \
613
	  "$(SUPP_PREFIX)/bin/autoconf"; \
753
##	  "$(SUPP_PREFIX)/bin/autoconf"; \
614
	  "$(SUPP_PREFIX)/bin/automake"; \
754
##	  "$(SUPP_PREFIX)/bin/automake"; \
615
	  "$(SUPP_PREFIX)/bin/autoheader"; \
755
##	  "$(SUPP_PREFIX)/bin/autoheader"; \
616
	  popd ; \
756
##	  popd ; \
617
	done; \
757
##	done; \
618
	popd; \
758
##	popd; \
619
	[ -d stamps ] || mkdir stamps ;
759
##	[ -d stamps ] || mkdir stamps ;
620
	touch stamps/regen-binutils;
760
##	touch stamps/regen-binutils;
621
761
622
.PHONY: build-binutils build-binutils-force
762
##.PHONY: build-binutils build-binutils-force
623
build-binutils: stamps/build-binutils
763
##build-binutils: stamps/build-binutils
624
build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
764
##build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
625
	cd binutils-$(BINUTILS_VERSION) ; \
765
##	cd binutils-$(BINUTILS_VERSION) ; \
626
	./configure   --enable-maintainer-mode		\
766
##	./configure   --enable-maintainer-mode		\
627
	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
767
##	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
628
	--disable-shared --disable-werror				\
768
##	--disable-shared --disable-werror				\
629
	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
769
##	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
630
	$(MAKE) all-bfd TARGET-bfd=headers; \
770
##	$(MAKE) all-bfd TARGET-bfd=headers; \
631
	rm bfd/Makefile; \
771
##	rm bfd/Makefile; \
632
	make configure-bfd; \
772
##	make configure-bfd; \
633
	$(MAKE)
773
##	$(MAKE)
634
	[ -d stamps ] || mkdir stamps ;
774
##	[ -d stamps ] || mkdir stamps ;
635
	touch stamps/build-binutils;
775
##	touch stamps/build-binutils;
636
776
637
.PHONY: install-binutils install-binutils-force
777
##.PHONY: install-binutils install-binutils-force
638
install-binutils: stamps/install-binutils
778
##install-binutils: stamps/install-binutils
639
install-binutils-force stamps/install-binutils: stamps/build-binutils
779
##install-binutils-force stamps/install-binutils: stamps/build-binutils
640
	cd binutils-$(BINUTILS_VERSION) && \
780
##	cd binutils-$(BINUTILS_VERSION) && \
641
	$(MAKE) installdirs install-host install-target
781
##	$(MAKE) installdirs install-host install-target
642
	[ -d stamps ] || mkdir stamps ;
782
##	[ -d stamps ] || mkdir stamps ;
643
	touch stamps/install-binutils;
783
##	touch stamps/install-binutils;
644
784
645
785
646
.PHONY: clean-binutils
786
##.PHONY: clean-binutils
647
clean-binutils:
787
##clean-binutils:
648
	rm -rf build/binutils stamps/*-binutils binutils-*
788
##	rm -rf build/binutils stamps/*-binutils binutils-*
649
789
650
.PHONY: realclean-binutils
790
##.PHONY: realclean-binutils
651
realclean-binutils: clean-binutils
791
##realclean-binutils: clean-binutils
652
	rm downloads/$(BINUTILS_ARCHIVE)
792
##	rm downloads/$(BINUTILS_ARCHIVE)
653
793
654
794
655
########## DFU PROGRAMMER ###########
795
########## DFU PROGRAMMER ###########
656
796
657
.PHONY: download-dfu download-dfu-force
797
.PHONY: download-dfu download-dfu-force
658
download-dfu: downloads/$(DFU_ARCHIVE)
798
download-dfu: downloads/$(DFU_ARCHIVE)
659
download-dfu-force downloads/$(DFU_ARCHIVE):
799
download-dfu-force downloads/$(DFU_ARCHIVE):
660
	[ -d downloads ] || mkdir downloads ;
800
	[ -d downloads ] || mkdir downloads ;
661
	cd downloads && curl -LO $(DFU_URL)
801
	cd downloads && curl -LO $(DFU_URL)
662
802
663
.PHONY: extract-dfu extract-dfu-force
803
.PHONY: extract-dfu extract-dfu-force
664
extract-dfu: stamps/extract-dfu
804
extract-dfu: stamps/extract-dfu
665
extract-dfu-force stamps/extract-dfu: downloads/$(DFU_ARCHIVE)
805
extract-dfu-force stamps/extract-dfu: downloads/$(DFU_ARCHIVE)
666
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
806
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
667
	[ "$$t1" = "$(DFU_MD5)" ] || \
807
	[ "$$t1" = "$(DFU_MD5)" ] || \
668
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
808
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
669
	tar -zxf $< ;
809
	tar -zxf $< ;
670
	[ -d stamps ] || mkdir stamps ;
810
	[ -d stamps ] || mkdir stamps ;
671
	touch stamps/extract-dfu;
811
	touch stamps/extract-dfu;
672
812
673
.PHONY: build-dfu build-dfu-force
813
.PHONY: build-dfu build-dfu-force
674
build-dfu: stamps/build-dfu
814
build-dfu: stamps/build-dfu
675
build-dfu-force stamps/build-dfu: stamps/extract-dfu
815
build-dfu-force stamps/build-dfu: stamps/extract-dfu
676
	mkdir -p build/dfu-programmer && cd build/dfu-programmer && \
816
	mkdir -p build/dfu-programmer && cd build/dfu-programmer && \
677
	../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \
817
	../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \
678
	$(MAKE) -j$(PROCS)
818
	$(MAKE) -j$(PROCS)
679
	[ -d stamps ] || mkdir stamps
819
	[ -d stamps ] || mkdir stamps
680
	touch stamps/build-dfu;
820
	touch stamps/build-dfu;
681
821
682
.PHONY: install-dfu install-dfu-force
822
.PHONY: install-dfu install-dfu-force
683
install-dfu: stamps/install-dfu
823
install-dfu: stamps/install-dfu
684
install-dfu-force stamps/install-dfu: stamps/build-dfu
824
install-dfu-force stamps/install-dfu: stamps/build-dfu
685
	cd build/dfu-programmer && \
825
	cd build/dfu-programmer && \
686
	$(MAKE) install
826
	$(MAKE) install
687
	[ -d stamps ] || mkdir stamps
827
	[ -d stamps ] || mkdir stamps
688
	touch stamps/install-dfu;
828
	touch stamps/install-dfu;
689
829
690
.PHONY: clean-dfu
830
.PHONY: clean-dfu
691
clean-dfu:
831
clean-dfu:
692
	rm -rf build/dfu stamps/*-dfu dfu-*
832
	rm -rf build/dfu stamps/*-dfu dfu-*
693
833
694
.PHONY: realclean-dfu
834
.PHONY: realclean-dfu
695
realclean-dfu: clean-dfu
835
realclean-dfu: clean-dfu
696
	rm downloads/$(DFU_ARCHIVE)
836
	rm downloads/$(DFU_ARCHIVE)
697
837
698
838
699
################ Bootstrap GCC ################
839
################ Bootstrap GCC ################
700
840
701
.PHONY: download-gcc download-gcc-force
841
.PHONY: download-gcc download-gcc-force
702
download-gcc: downloads/$(GCC_ARCHIVE)
842
download-gcc: downloads/$(GCC_ARCHIVE)
703
download-gcc-force downloads/$(GCC_ARCHIVE):
843
download-gcc-force downloads/$(GCC_ARCHIVE):
704
	[ -d downloads ] || mkdir downloads ;
844
	[ -d downloads ] || mkdir downloads ;
705
	cd downloads && curl -LO $(GCC_URL)
845
	cd downloads && curl -LO $(GCC_URL)
706
846
707
.PHONY: extract-gcc extract-gcc-force
847
.PHONY: extract-gcc extract-gcc-force
708
extract-gcc: stamps/extract-gcc
848
extract-gcc: stamps/extract-gcc
709
extract-gcc-force stamps/extract-gcc: downloads/$(GCC_ARCHIVE)
849
extract-gcc-force stamps/extract-gcc: downloads/$(GCC_ARCHIVE)
710
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
850
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
711
	[ "$$t1" = "$(GCC_MD5)" ] || \
851
	[ "$$t1" = "$(GCC_MD5)" ] || \
712
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
852
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
713
	tar -jxf $< ;
853
	tar -jxf $< ;
714
	[ -d stamps ] || mkdir stamps ;
854
	[ -d stamps ] || mkdir stamps ;
715
	touch stamps/extract-gcc;
855
	touch stamps/extract-gcc;
716
856
717
.PHONY: patch-gcc patch-gcc-force
857
.PHONY: patch-gcc patch-gcc-force
718
patch-gcc: stamps/patch-gcc
858
patch-gcc: stamps/patch-gcc
719
patch-gcc-force stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches
859
patch-gcc-force stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches
720
	pushd gcc-$(GCC_VERSION) ; \
860
	pushd gcc-$(GCC_VERSION) ; \
721
	for f in ../source/avr32/gcc/*.patch; do \
861
	for f in ../source/avr32/gcc/*.patch; do \
722
	patch -N -p0 <$${f} ; \
862
	patch -N -p0 <$${f} ; \
723
	done ; \
863
	done ; \
724
	popd ;
864
	popd ;
725
	[ -d stamps ] || mkdir stamps
865
	[ -d stamps ] || mkdir stamps
726
	touch stamps/patch-gcc;
866
	touch stamps/patch-gcc;
727
867
728
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections			\
868
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections			\
729
-fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g	\
869
-fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g	\
730
-Os -fno-unroll-loops"
870
-Os -fno-unroll-loops"
731
871
732
.PHONY: build-gcc build-gcc-force
872
.PHONY: build-gcc build-gcc-force
733
build-gcc: stamps/build-gcc
873
build-gcc: stamps/build-gcc
734
build-gcc-force stamps/build-gcc: stamps/install-binutils stamps/patch-gcc
874
build-gcc-force stamps/build-gcc: stamps/install-binutils stamps/patch-gcc
735
	mkdir -p build/gcc && cd build/gcc && \
875
	mkdir -p build/gcc && cd build/gcc && \
736
	pushd ../../gcc-$(GCC_VERSION) ; \
876
	pushd ../../gcc-$(GCC_VERSION) ; \
737
	make clean ; \
877
	make clean ; \
738
	popd ; \
878
	popd ; \
739
	../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)"		\
879
	../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)"		\
740
	--target=$(TARGET) --enable-languages="c" --with-gnu-ld		\
880
	--target=$(TARGET) --enable-languages="c" --with-gnu-ld		\
741
	--with-gnu-as --with-newlib --disable-nls --disable-libssp	\
881
	--with-gnu-as --with-newlib --disable-nls --disable-libssp	\
742
	--with-dwarf2 --enable-sjlj-exceptions				\
882
	--with-dwarf2 --enable-sjlj-exceptions				\
743
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch	\
883
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch	\
744
	--disable-shared						\
884
	--disable-shared						\
745
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
885
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
746
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET)				\
886
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET)				\
747
	--with-sysroot="$(PREFIX)/$(TARGET)"				\
887
	--with-sysroot="$(PREFIX)/$(TARGET)"				\
748
	--with-build-sysroot="$(PREFIX)/$(TARGET)"			\
888
	--with-build-sysroot="$(PREFIX)/$(TARGET)"			\
749
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
889
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
750
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)				\
890
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)				\
751
	LDFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
891
	LDFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
752
	CPPFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
892
	CPPFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
753
	--with-bugurl=$(BUG_URL) \
893
	--with-bugurl=$(BUG_URL) \
754
	--with-pkgversion=$(PKG_VERSION) && \
894
	--with-pkgversion=$(PKG_VERSION) && \
755
	$(MAKE) -j$(PROCS)
895
	$(MAKE) -j$(PROCS)
756
	[ -d stamps ] || mkdir stamps
896
	[ -d stamps ] || mkdir stamps
757
	touch stamps/build-gcc;
897
	touch stamps/build-gcc;
758
898
759
.PHONY: install-gcc install-gcc-force
899
.PHONY: install-gcc install-gcc-force
760
install-gcc: stamps/install-gcc
900
install-gcc: stamps/install-gcc
761
install-gcc-force stamps/install-gcc: stamps/build-gcc
901
install-gcc-force stamps/install-gcc: stamps/build-gcc
762
	cd build/gcc && \
902
	cd build/gcc && \
763
	$(MAKE) installdirs install-target && \
903
	$(MAKE) installdirs install-target && \
764
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
904
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
765
	[ -d stamps ] || mkdir stamps
905
	[ -d stamps ] || mkdir stamps
766
	touch stamps/install-gcc;
906
	touch stamps/install-gcc;
767
907
768
.PHONY: clean-gcc
908
.PHONY: clean-gcc
769
clean-gcc:
909
clean-gcc:
770
	rm -rf build/gcc stamps/*-gcc gcc-*
910
	rm -rf build/gcc stamps/*-gcc gcc-*
771
911
772
.PHONY: realclean-gcc
912
.PHONY: realclean-gcc
773
realclean-gcc: clean-gcc
913
realclean-gcc: clean-gcc
774
	rm downloads/$(GCC_ARCHIVE)
914
	rm downloads/$(GCC_ARCHIVE)
775
915
776
916
777
################ Final GCC ################
917
################ Final GCC ################
778
918
779
.PHONY: build-final-gcc build-final-gcc-force
919
.PHONY: build-final-gcc build-final-gcc-force
780
build-final-gcc: stamps/build-final-gcc
920
build-final-gcc: stamps/build-final-gcc
781
build-final-gcc-force stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/patch-gcc
921
build-final-gcc-force stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/patch-gcc
782
	mkdir -p build/final-gcc && cd build/final-gcc && \
922
	mkdir -p build/final-gcc && cd build/final-gcc && \
783
	pushd ../../gcc-$(GCC_VERSION) ; \
923
	pushd ../../gcc-$(GCC_VERSION) ; \
784
	make clean ; \
924
	make clean ; \
785
	popd ; \
925
	popd ; \
786
	../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \
926
	../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \
787
	--target=$(TARGET) $(DEPENDENCIES) --enable-languages="c,c++" --with-gnu-ld \
927
	--target=$(TARGET) $(DEPENDENCIES) --enable-languages="c,c++" --with-gnu-ld \
788
	--with-gnu-as --with-newlib --disable-nls --disable-libssp \
928
	--with-gnu-as --with-newlib --disable-nls --disable-libssp \
789
	--with-dwarf2 --enable-sjlj-exceptions \
929
	--with-dwarf2 --enable-sjlj-exceptions \
790
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch \
930
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch \
791
	--disable-shared --enable-__cxa_atexit \
931
	--disable-shared --enable-__cxa_atexit \
792
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
932
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
793
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET) \
933
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET) \
794
	--with-sysroot=$(PREFIX)/$(TARGET) \
934
	--with-sysroot=$(PREFIX)/$(TARGET) \
795
	--with-build-sysroot=$(PREFIX)/$(TARGET) \
935
	--with-build-sysroot=$(PREFIX)/$(TARGET) \
796
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
936
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
797
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \
937
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \
798
	LDFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
938
	LDFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
799
	CPPFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
939
	CPPFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
800
	--with-bugurl=$(BUG_URL) \
940
	--with-bugurl=$(BUG_URL) \
801
	--with-pkgversion=$(PKG_VERSION) && \
941
	--with-pkgversion=$(PKG_VERSION) && \
802
	$(MAKE) -j$(PROCS)
942
	$(MAKE) -j$(PROCS)
803
	[ -d stamps ] || mkdir stamps
943
	[ -d stamps ] || mkdir stamps
804
	touch stamps/build-final-gcc;
944
	touch stamps/build-final-gcc;
805
945
806
.PHONY: install-final-gcc install-final-gcc-force
946
.PHONY: install-final-gcc install-final-gcc-force
807
install-final-gcc: stamps/install-final-gcc
947
install-final-gcc: stamps/install-final-gcc
808
install-final-gcc-force stamps/install-final-gcc: stamps/build-final-gcc
948
install-final-gcc-force stamps/install-final-gcc: stamps/build-final-gcc
809
	cd build/final-gcc && \
949
	cd build/final-gcc && \
810
	$(MAKE) installdirs install-target && \
950
	$(MAKE) installdirs install-target && \
811
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
951
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
812
	[ -d stamps ] || mkdir stamps
952
	[ -d stamps ] || mkdir stamps
813
	touch stamps/install-final-gcc;
953
	touch stamps/install-final-gcc;
814
954
815
.PHONY: clean-final-gcc
955
.PHONY: clean-final-gcc
816
clean-final-gcc: clean-gcc
956
clean-final-gcc: clean-gcc
817
	rm -rf build/final-gcc stamps/*-final-gcc
957
	rm -rf build/final-gcc stamps/*-final-gcc
818
958
819
.PHONY: realclean-final-gcc
959
.PHONY: realclean-final-gcc
820
realclean-final-gcc: realclean-gcc
960
realclean-final-gcc: realclean-gcc
821
961
822
962
823
########## GDB ###########
963
########## GDB ###########
824
964
825
.PHONY: download-gdb download-gdb-force
965
.PHONY: download-gdb download-gdb-force
826
download-gdb: downloads/$(GDB_ARCHIVE)
966
download-gdb: downloads/$(GDB_ARCHIVE)
827
download-gdb-force downloads/$(GDB_ARCHIVE):
967
download-gdb-force downloads/$(GDB_ARCHIVE):
828
	[ -d downloads ] || mkdir downloads ;
968
	[ -d downloads ] || mkdir downloads ;
829
	cd downloads && curl -LO $(GDB_URL)
969
	cd downloads && curl -LO $(GDB_URL)
830
970
831
.PHONY: extract-gdb extract-gdb-force
971
.PHONY: extract-gdb extract-gdb-force
832
extract-gdb: stamps/extract-gdb
972
extract-gdb: stamps/extract-gdb
833
extract-gdb-force stamps/extract-gdb: downloads/$(GDB_ARCHIVE)
973
extract-gdb-force stamps/extract-gdb: downloads/$(GDB_ARCHIVE)
834
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
974
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
835
	[ "$$t1" = "$(GDB_MD5)" ] || \
975
	[ "$$t1" = "$(GDB_MD5)" ] || \
836
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
976
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
837
	tar -jxf $< ;
977
	tar -jxf $< ;
838
	[ -d stamps ] || mkdir stamps ;
978
	[ -d stamps ] || mkdir stamps ;
839
	touch stamps/extract-gdb;
979
	touch stamps/extract-gdb;
840
980
841
.PHONY: patch-gdb patch-gdb-force
981
.PHONY: patch-gdb patch-gdb-force
842
patch-gdb: stamps/patch-gdb
982
patch-gdb: stamps/patch-gdb
843
patch-gdb-force stamps/patch-gdb: stamps/extract-gdb stamps/extract-avr32patches
983
patch-gdb-force stamps/patch-gdb: stamps/extract-gdb stamps/extract-avr32patches
844
	pushd gdb-$(GDB_VERSION) ; \
984
	pushd gdb-$(GDB_VERSION) ; \
845
	for f in ../source/avr32/gdb/*.patch; do \
985
	for f in ../source/avr32/gdb/*.patch; do \
846
	patch -N -p0 <$${f} ; \
986
	patch -N -p0 <$${f} ; \
847
	done ; \
987
	done ; \
848
	popd ; \
988
	popd ; \
849
	[ -d stamps ] || mkdir stamps
989
	[ -d stamps ] || mkdir stamps
850
	touch stamps/patch-gdb;
990
	touch stamps/patch-gdb;
851
991
852
.PHONY: regen-gdb regen-gdb-force
992
.PHONY: regen-gdb regen-gdb-force
853
regen-gdb: stamps/regen-gdb
993
regen-gdb: stamps/regen-gdb
854
regen-gdb-force stamps/regen-gdb: stamps/patch-gdb stamps/install-supp-tools
994
regen-gdb-force stamps/regen-gdb: stamps/patch-gdb stamps/install-supp-tools
855
	pushd gdb-$(GDB_VERSION) ; \
995
	pushd gdb-$(GDB_VERSION) ; \
856
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
996
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
857
	"$(SUPP_PREFIX)/bin/autoconf" ; \
997
	"$(SUPP_PREFIX)/bin/autoconf" ; \
858
	"$(SUPP_PREFIX)/bin/automake" ; \
998
	"$(SUPP_PREFIX)/bin/automake" ; \
859
	"$(SUPP_PREFIX)/bin/autoheader" ; \
999
	"$(SUPP_PREFIX)/bin/autoheader" ; \
860
	for dir in bfd opcodes gdb; do \
1000
	for dir in bfd opcodes gdb; do \
861
	  pushd $$dir ; \
1001
	  pushd $$dir ; \
862
	  echo "JESS 1: $$dir" >&2 ; \
1002
	  echo "JESS 1: $$dir" >&2 ; \
863
	  "$(SUPP_PREFIX)/bin/autoconf"; \
1003
	  "$(SUPP_PREFIX)/bin/autoconf"; \
864
	  "$(SUPP_PREFIX)/bin/automake"; \
1004
	  "$(SUPP_PREFIX)/bin/automake"; \
865
	  "$(SUPP_PREFIX)/bin/autoheader"; \
1005
	  "$(SUPP_PREFIX)/bin/autoheader"; \
866
	  echo "JESS 2: $$dir" >&2 ; \
1006
	  echo "JESS 2: $$dir" >&2 ; \
867
	  popd ; \
1007
	  popd ; \
868
	done; \
1008
	done; \
869
	popd; \
1009
	popd; \
870
	[ -d stamps ] || mkdir stamps ;
1010
	[ -d stamps ] || mkdir stamps ;
871
	touch stamps/regen-gdb;
1011
	touch stamps/regen-gdb;
872
1012
873
.PHONY: build-gdb build-gdb-force
1013
.PHONY: build-gdb build-gdb-force
874
build-gdb: stamps/build-gdb
1014
build-gdb: stamps/build-gdb
875
build-gdb-force stamps/build-gdb: stamps/regen-gdb stamps/install-supp-tools
1015
build-gdb-force stamps/build-gdb: stamps/regen-gdb stamps/install-supp-tools
876
	echo "JESS 3" >&2 ; \
1016
	echo "JESS 3" >&2 ; \
877
	mkdir -p build/gdb && cd build/gdb && \
1017
	mkdir -p build/gdb && cd build/gdb && \
878
	../../gdb-$(GDB_VERSION)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
1018
	../../gdb-$(GDB_VERSION)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
879
	$(MAKE) -j$(PROCS)
1019
	$(MAKE) -j$(PROCS)
880
	$(MAKE) installdirs install-host install-target
1020
	$(MAKE) installdirs install-host install-target
881
	[ -d stamps ] || mkdir stamps
1021
	[ -d stamps ] || mkdir stamps
882
	touch stamps/build-gdb;
1022
	touch stamps/build-gdb;
883
1023
884
.PHONY: install-gdb install-gdb-force
1024
.PHONY: install-gdb install-gdb-force
885
install-gdb: stamps/install-gdb
1025
install-gdb: stamps/install-gdb
886
install-gdb-force stamps/install-gdb: stamps/build-gdb
1026
install-gdb-force stamps/install-gdb: stamps/build-gdb
887
	cd build/gdb && \
1027
	cd build/gdb && \
888
	$(MAKE) install
1028
	$(MAKE) install
889
	[ -d stamps ] || mkdir stamps
1029
	[ -d stamps ] || mkdir stamps
890
	touch stamps/install-gdb;
1030
	touch stamps/install-gdb;
891
1031
892
.PHONY: clean-gdb
1032
.PHONY: clean-gdb
893
clean-gdb:
1033
clean-gdb:
894
	rm -rf build/gdb stamps/*-gdb gdb-*
1034
	rm -rf build/gdb stamps/*-gdb gdb-*
895
1035
896
.PHONY: realclean-gdb
1036
.PHONY: realclean-gdb
897
realclean-gdb: clean-gdb
1037
realclean-gdb: clean-gdb
898
	rm downloads/$(GDB_ARCHIVE)
1038
	rm downloads/$(GDB_ARCHIVE)
899
1039
900
################ NON-WORKING/NON-ADJUSTED TARGETS ################
1040
################ NON-WORKING/NON-ADJUSTED TARGETS ################
901
1041
902
1042
903
gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/
1043
gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/
904
	pushd gcc-$(GCC_VERSION)-$(CS_BASE) ; \
1044
	pushd gcc-$(GCC_VERSION)-$(CS_BASE) ; \
905
	patch -N -p1 < ../patches/gcc-optsize.patch ; \
1045
	patch -N -p1 < ../patches/gcc-optsize.patch ; \
906
	popd ;
1046
	popd ;
907
1047
908
gmp: gmp-$(CS_BASE)/ sudomode
1048
gmp: gmp-$(CS_BASE)/ sudomode
909
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
1049
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
910
	pushd ../../gmp-$(CS_BASE) ; \
1050
	pushd ../../gmp-$(CS_BASE) ; \
911
	make clean ; \
1051
	make clean ; \
912
	popd ; \
1052
	popd ; \
913
	sudo -u $(SUDO_USER) ../../gmp-$(CS_BASE)/configure --disable-shared && \
1053
	sudo -u $(SUDO_USER) ../../gmp-$(CS_BASE)/configure --disable-shared && \
914
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
1054
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
915
	$(MAKE) install
1055
	$(MAKE) install
916
1056
917
mpc: mpc-$(MPC_VERSION)/ sudomode
1057
mpc: mpc-$(MPC_VERSION)/ sudomode
918
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
1058
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
919
	pushd ../../mpc-$(MPC_VERSION) ; \
1059
	pushd ../../mpc-$(MPC_VERSION) ; \
920
	make clean ; \
1060
	make clean ; \
921
	popd ; \
1061
	popd ; \
922
	sudo -u $(SUDO_USER) ../../mpc-$(MPC_VERSION)/configure --disable-shared && \
1062
	sudo -u $(SUDO_USER) ../../mpc-$(MPC_VERSION)/configure --disable-shared && \
923
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
1063
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
924
	$(MAKE) install
1064
	$(MAKE) install
925
1065
926
mpc-$(MPC_VERSION) : $(LOCAL_BASE)/mpc-$(CS_VERSION).tar.bz2
1066
mpc-$(MPC_VERSION) : $(LOCAL_BASE)/mpc-$(CS_VERSION).tar.bz2
927
ifeq ($(USER),root)
1067
ifeq ($(USER),root)
928
	sudo -u $(SUDO_USER) tar -jxf $<
1068
	sudo -u $(SUDO_USER) tar -jxf $<
929
else
1069
else
930
	tar -jxf $<
1070
	tar -jxf $<
931
endif
1071
endif
932
1072
933
mpfr: gmp mpfr-$(CS_BASE)/ sudomode
1073
mpfr: gmp mpfr-$(CS_BASE)/ sudomode
934
	sudo -u $(SUDO_USER) mkdir -p build/mpfr && cd build/mpfr && \
1074
	sudo -u $(SUDO_USER) mkdir -p build/mpfr && cd build/mpfr && \
935
	pushd ../../mpfr-$(CS_BASE) ; \
1075
	pushd ../../mpfr-$(CS_BASE) ; \
936
	make clean ; \
1076
	make clean ; \
937
	popd ; \
1077
	popd ; \
938
	sudo -u $(SUDO_USER) ../../mpfr-$(CS_BASE)/configure LDFLAGS="-Wl,-search_paths_first" --disable-shared && \
1078
	sudo -u $(SUDO_USER) ../../mpfr-$(CS_BASE)/configure LDFLAGS="-Wl,-search_paths_first" --disable-shared && \
939
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
1079
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
940
	$(MAKE) install
1080
	$(MAKE) install
941
1081
942
cross-gdb: gdb-$(CS_BASE)/
1082
cross-gdb: gdb-$(CS_BASE)/
943
	mkdir -p build/gdb && cd build/gdb && \
1083
	mkdir -p build/gdb && cd build/gdb && \
944
	pushd ../../gdb-$(CS_BASE) ; \
1084
	pushd ../../gdb-$(CS_BASE) ; \
945
	make clean ; \
1085
	make clean ; \
946
	popd ; \
1086
	popd ; \
947
	../../gdb-$(CS_BASE)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
1087
	../../gdb-$(CS_BASE)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
948
	$(MAKE) -j$(PROCS) && \
1088
	$(MAKE) -j$(PROCS) && \
949
	$(MAKE) installdirs install-host install-target && \
1089
	$(MAKE) installdirs install-host install-target && \
950
	mkdir -p "$(PREFIX)/man/man1" && \
1090
	mkdir -p "$(PREFIX)/man/man1" && \
951
	cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1"
1091
	cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1"
952
1092
953
.PHONY : clean
1093
.PHONY : clean
954
clean:
1094
clean:
955
	rm -rf build *-$(CS_BASE) binutils-* gcc-* gdb-* newlib-* mpc-* $(LOCAL_BASE) dfu-programmer-* autoconf-* automake-* stamps/* source supp
1095
	rm -rf build *-$(CS_BASE) binutils-* gcc-* gdb-* newlib-* mpc-* $(LOCAL_BASE) dfu-programmer-* autoconf-* automake-* stamps/* source supp