Subversion Repositories avr32-toolchain

Rev

Rev 19 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19 Rev 21
1
# AVR32 Toolchain Makefile
1
# AVR32 Toolchain Makefile
2
#
2
#
3
# Copyright (C) 2012 by Jasmin Jessich <jasmin.jessich@frequentis.com>
3
# Copyright (C) 2012 by Jasmin Jessich <jasmin.jessich@frequentis.com>
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
# This Makefile is based on the one from here:
23
# This Makefile is based on the one from here:
24
#    https://github.com/jsnyder/avr32-toolchain/blob/master/Makefile
24
#    https://github.com/jsnyder/avr32-toolchain/blob/master/Makefile
25
#    Copyright (C) 2011 by James Snyder <jbsnyder@fanplastic.org>
25
#    Copyright (C) 2011 by James Snyder <jbsnyder@fanplastic.org>
-
 
26
#
-
 
27
-
 
28
26
29
-
 
30
###############################################################################
27
#
31
#
-
 
32
# The origial version couldn't handle delta building of parts, which is
-
 
33
# required during patch development. I didn't want to fix all the different
-
 
34
# make steps seperately. So I decided to use an new approach, which I never
28
# This makefile uses macros to generate the different rules for the different
35
# tried before. I used make macros to generate the different rules for the
-
 
36
# different tools.
29
# tools. This saves a lot of work, when a new tool is added. Moreover, bugfixes
37
# This saved me a lot of work, when a new tool is added. Moreover, bugfixes
-
 
38
# have to be done only one place. Enhancments of the targets need to be done
30
# have to be done only one place.
39
# on only one place.
-
 
40
# The drawback of this approach is a little mor complexity when writing shell
-
 
41
# scripts within the make macro. You need a lot of '$' for escaping.
-
 
42
#
-
 
43
# I have tested most of the targets with a lot of compinations, but there might
-
 
44
# one which is not working. Please send me a bug report, if you find such a
-
 
45
# combination.
-
 
46
#
-
 
47
# The development SVN repository can be found at
-
 
48
#  http://web.anw.at/websvn/listing.php?repname=avr32-toolchain
31
#
49
#
32
# NOTE: Currently ONLY binutils is finished!
50
# NOTE: Currently ONLY binutils is finished!
33
#
51
#
-
 
52
###############################################################################
-
 
53
34
54
35
55
36
#### PRIMARY TOOLCHAIN VERSIONS #####
56
#### PRIMARY TOOLCHAIN VERSIONS #####
37
57
38
GCC_VERSION       = 4.4.3
58
GCC_VERSION       = 4.4.3
39
GDB_VERSION       = 6.7.1
59
GDB_VERSION       = 6.7.1
40
GDB_VERSION_DLOAD = $(GDB_VERSION)a
60
GDB_VERSION_DLOAD = $(GDB_VERSION)a
41
#BINUTILS_VERSION  = 2.20.1
61
#BINUTILS_VERSION  = 2.20.1
42
BINUTILS_VERSION  = 2.22
62
BINUTILS_VERSION  = 2.22
43
NEWLIB_VERSION    = 1.16.0
63
NEWLIB_VERSION    = 1.16.0
44
DFU_VERSION       = 0.5.4
64
DFU_VERSION       = 0.5.4
45
AVR_PATCH_REV	  = 3.2.3.261
65
AVR_PATCH_REV	  = 3.2.3.261
46
AVR_HEADER_REV    = 3.2.3.258
66
AVR_HEADER_REV    = 3.2.3.258
47
67
48
68
49
#### PATHS AND ENVIRONMENT VARIABLES #####
69
#### PATHS AND ENVIRONMENT VARIABLES #####
50
70
51
SHELL       = /bin/bash
71
SHELL       = /bin/bash
52
TARGET      = avr32
72
TARGET      = avr32
53
73
54
TODAY = $(shell date "+%Y%m%d")
74
TODAY = $(shell date "+%Y%m%d")
55
GIT_REV	    = $(shell git rev-parse --verify HEAD --short 2> /dev/null)
75
GIT_REV	    = $(shell git rev-parse --verify HEAD --short 2> /dev/null)
56
SVN_REV	    = $(shell head -1 ReleaseNotes 2> /dev/null | cut -f 1 -d " ")
76
SVN_REV	    = $(shell head -1 ReleaseNotes 2> /dev/null | cut -f 1 -d " ")
57
77
-
 
78
PREFIX_RELEASE ?= /opt/avr/avr32-tools
-
 
79
58
ifeq ($(strip $(GIT_REV)),)
80
ifeq ($(strip $(GIT_REV)),)
59
ifeq ($(strip $(SVN_REV)),)
81
ifeq ($(strip $(SVN_REV)),)
60
PREFIX     ?= $(HOME)/avr32-tools-$(TODAY)
82
PREFIX     ?= $(HOME)/avr32-tools-$(TODAY)
61
TOOL_REV   = $(TODAY)
83
TOOL_REV   = $(TODAY)
62
else
84
else
63
PREFIX     ?= $(HOME)/avr32-tools-$(SVN_REV)
85
PREFIX     ?= $(HOME)/avr32-tools-$(SVN_REV)
64
TOOL_REV   = $(SVN_REV)
86
TOOL_REV   = $(SVN_REV)
65
BUG_URL = jasmin@anw.at
87
BUG_URL = jasmin@anw.at
66
endif
88
endif
67
else
89
else
68
PREFIX     ?= $(HOME)/avr32-tools-$(GIT_REV)
90
PREFIX     ?= $(HOME)/avr32-tools-$(GIT_REV)
69
TOOL_REV   = $(GIT_REV)
91
TOOL_REV   = $(GIT_REV)
70
endif
92
endif
71
93
72
ifeq ($(UNAME), Linux)
94
ifeq ($(UNAME), Linux)
73
PROCS  ?= $(shell grep -c ^processor /proc/cpuinfo)
95
PROCS  ?= $(shell grep -c ^processor /proc/cpuinfo)
74
else ifeq ($(UNAME), Darwin)
96
else ifeq ($(UNAME), Darwin)
75
PROCS  ?= $(shell sysctl hw.ncpu | awk '{print $$2}')
97
PROCS  ?= $(shell sysctl hw.ncpu | awk '{print $$2}')
76
else
98
else
77
PROCS  ?= 2
99
PROCS  ?= 2
78
endif
100
endif
79
101
-
 
102
-
 
103
RELEASE_VERSION ?= no
-
 
104
PREFIX_RELEASE ?= /opt/avr/avr32-tools
-
 
105
-
 
106
ifneq ($(RELEASE_VERSION),no)
-
 
107
FULL_STATIC = y
-
 
108
PREFIX = $(PREFIX_RELEASE)-$(RELEASE_VERSION)
-
 
109
endif
-
 
110
-
 
111
-
 
112
# enable complete static linking
-
 
113
FULL_STATIC ?= no
-
 
114
80
# enable maintainer-mode with yes
115
# enable maintainer-mode with yes
81
M_MODE ?= no
116
M_MODE ?= no
82
117
83
# enable binutils autotool file regeneration with yes
118
# enable binutils autotool file regeneration with yes
84
BINUTILS_REGEN ?= no
119
BINUTILS_REGEN ?= no
85
120
86
121
87
SUPP_PREFIX = $(CURDIR)/supp
122
SUPP_PREFIX = $(CURDIR)/supp
88
PATH       := ${PREFIX}/bin:${SUPP_PREFIX}/bin:${PATH}
123
PATH       := ${PREFIX}/bin:${SUPP_PREFIX}/bin:${PATH}
89
AUTOCONF    = $(SUPP_PREFIX)/bin/autoconf
124
AUTOCONF    = $(SUPP_PREFIX)/bin/autoconf
90
AUTOMAKE    = $(SUPP_PREFIX)/bin/automake
125
AUTOMAKE    = $(SUPP_PREFIX)/bin/automake
91
126
92
STAMP_DIR  := $(CURDIR)/stamps
127
STAMP_DIR  := $(CURDIR)/stamps
93
DOWNLOAD_DIR := $(CURDIR)/downloads
128
DOWNLOAD_DIR := $(CURDIR)/downloads
94
BUILD_DIR := $(CURDIR)/build
129
BUILD_DIR := $(CURDIR)/build
95
130
96
ifeq ($(strip $(BUG_URL)),)
131
ifeq ($(strip $(BUG_URL)),)
97
BUG_URL = https://github.com/jsnyder/avr32-toolchain
132
BUG_URL = https://github.com/jsnyder/avr32-toolchain
98
endif
133
endif
99
#PKG_VERSION ?= "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)"
134
#PKG_VERSION ?= "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)"
100
PKG_VERSION ?= "AVR 32 bit GNU Toolchain-$(TOOL_REV)"
135
PKG_VERSION ?= "AVR 32 bit GNU Toolchain-$(TOOL_REV)"
101
136
102
137
103
#### PRIMARY TOOLCHAIN URLS #####
138
#### PRIMARY TOOLCHAIN URLS #####
104
139
105
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
140
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
106
GCC_URL = http://mirror.anl.gov/pub/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE)
141
GCC_URL = http://mirror.anl.gov/pub/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE)
107
GCC_MD5 = fe1ca818fc6d2caeffc9051fe67ff103
142
GCC_MD5 = fe1ca818fc6d2caeffc9051fe67ff103
108
143
109
GDB_ARCHIVE = gdb-$(GDB_VERSION_DLOAD).tar.bz2
144
GDB_ARCHIVE = gdb-$(GDB_VERSION_DLOAD).tar.bz2
110
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
145
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
111
GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214
146
GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214
112
147
113
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
148
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
114
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
149
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
115
# V 2.20.1
150
# V 2.20.1
116
#BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
151
#BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
117
# V 2.22
152
# V 2.22
118
BINUTILS_MD5 = ee0f10756c84979622b992a4a61ea3f5
153
BINUTILS_MD5 = ee0f10756c84979622b992a4a61ea3f5
119
154
120
NEWLIB_ARCHIVE = newlib-$(NEWLIB_VERSION).tar.gz
155
NEWLIB_ARCHIVE = newlib-$(NEWLIB_VERSION).tar.gz
121
NEWLIB_URL = ftp://sources.redhat.com/pub/newlib/$(NEWLIB_ARCHIVE)
156
NEWLIB_URL = ftp://sources.redhat.com/pub/newlib/$(NEWLIB_ARCHIVE)
122
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
157
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
123
158
124
AVR32PATCHES_ARCHIVE = avr32-gnu-toolchain-$(AVR_PATCH_REV)-source.zip
159
AVR32PATCHES_ARCHIVE = avr32-gnu-toolchain-$(AVR_PATCH_REV)-source.zip
125
AVR32PATCHES_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32PATCHES_ARCHIVE)
160
AVR32PATCHES_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32PATCHES_ARCHIVE)
126
AVR32PATCHES_MD5 = 69a03828a328068f25d457cfd8341857
161
AVR32PATCHES_MD5 = 69a03828a328068f25d457cfd8341857
127
install_dir_avr32patches := source/avr32
162
install_dir_avr32patches := source/avr32
128
163
129
NEWPATCHESBINUTILS_ARCHIVE = binutils-2.22-avr32-full.patch
164
NEWPATCHESBINUTILS_ARCHIVE = binutils-2.22-avr32-full.patch
130
NEWPATCHESBINUTILS_URL=http://avr.anw.at/avr32/patches/binutils/2_22/$(NEWPATCHESBINUTILS_ARCHIVE)
165
NEWPATCHESBINUTILS_URL=http://avr.anw.at/avr32/patches/binutils/2_22/$(NEWPATCHESBINUTILS_ARCHIVE)
131
NEWPATCHESBINUTILS_MD5 = aca9dd1aaeda63fa1a0cc4c68b94fa6f
166
NEWPATCHESBINUTILS_MD5 = 09c091b9acb369fd39fb21d0334bb9a6
132
install_dir_newpatchesbinutils := source/avr32/binutils
167
install_dir_newpatchesbinutils := source/avr32/binutils
133
168
134
AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip
169
AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip
135
AVR32HEADERS_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32HEADERS_ARCHIVE)
170
AVR32HEADERS_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32HEADERS_ARCHIVE)
136
AVR32HEADERS_MD5 = 3293d70a46e460d342e1f939b8e0d228
171
AVR32HEADERS_MD5 = 3293d70a46e460d342e1f939b8e0d228
137
172
138
DFU_ARCHIVE = dfu-programmer-$(DFU_VERSION).tar.gz
173
DFU_ARCHIVE = dfu-programmer-$(DFU_VERSION).tar.gz
139
DFU_URL = http://surfnet.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/$(DFU_VERSION)/$(DFU_ARCHIVE)
174
DFU_URL = http://surfnet.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/$(DFU_VERSION)/$(DFU_ARCHIVE)
140
DFU_MD5 = 707dcd0f957a74e92456ea6919faa772
175
DFU_MD5 = 707dcd0f957a74e92456ea6919faa772
141
176
142
177
143
##### SUPPORT TOOLS VERSIONS / URLS ######
178
##### SUPPORT TOOLS VERSIONS / URLS ######
144
AUTOCONF_VERSION = 2.64
179
AUTOCONF_VERSION = 2.64
145
#AUTOMAKE_VERSION = 1.11
180
#AUTOMAKE_VERSION = 1.11
146
AUTOMAKE_VERSION = 1.11.1
181
AUTOMAKE_VERSION = 1.11.1
147
LIBTOOL_VERSION = 2.2.6b
182
LIBTOOL_VERSION = 2.2.6b
148
DEJAGNU_VERSION = 1.5
183
DEJAGNU_VERSION = 1.5
149
MPC_VERSION = 0.8.1
184
MPC_VERSION = 0.8.1
150
185
151
AUTOCONF_ARCHIVE = autoconf-$(AUTOCONF_VERSION).tar.bz2
186
AUTOCONF_ARCHIVE = autoconf-$(AUTOCONF_VERSION).tar.bz2
152
AUTOCONF_URL = http://mirror.anl.gov/pub/gnu/autoconf/$(AUTOCONF_ARCHIVE)
187
AUTOCONF_URL = http://mirror.anl.gov/pub/gnu/autoconf/$(AUTOCONF_ARCHIVE)
153
AUTOCONF_MD5 = ef400d672005e0be21e0d20648169074
188
AUTOCONF_MD5 = ef400d672005e0be21e0d20648169074
154
189
155
AUTOMAKE_ARCHIVE = automake-$(AUTOMAKE_VERSION).tar.bz2
190
AUTOMAKE_ARCHIVE = automake-$(AUTOMAKE_VERSION).tar.bz2
156
AUTOMAKE_URL = http://mirror.anl.gov/pub/gnu/automake/$(AUTOMAKE_ARCHIVE)
191
AUTOMAKE_URL = http://mirror.anl.gov/pub/gnu/automake/$(AUTOMAKE_ARCHIVE)
157
# V 1.11
192
# V 1.11
158
#AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
193
#AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
159
# V 1.11.1
194
# V 1.11.1
160
AUTOMAKE_MD5 = c2972c4d9b3e29c03d5f2af86249876f
195
AUTOMAKE_MD5 = c2972c4d9b3e29c03d5f2af86249876f
161
196
162
LIBTOOL_ARCHIVE = libtool-$(LIBTOOL_VERSION).tar.gz
197
LIBTOOL_ARCHIVE = libtool-$(LIBTOOL_VERSION).tar.gz
163
LIBTOOL_URL = http://mirror.anl.gov/pub/gnu/libtool/$(LIBTOOL_ARCHIVE)
198
LIBTOOL_URL = http://mirror.anl.gov/pub/gnu/libtool/$(LIBTOOL_ARCHIVE)
164
LIBTOOL_MD5 = 07da460450490148c6d2df0f21481a25
199
LIBTOOL_MD5 = 07da460450490148c6d2df0f21481a25
165
200
166
DEJAGNU_ARCHIVE = dejagnu-$(DEJAGNU_VERSION).tar.gz
201
DEJAGNU_ARCHIVE = dejagnu-$(DEJAGNU_VERSION).tar.gz
167
DEJAGNU_URL = http://mirror.anl.gov/pub/gnu/dejagnu/$(DEJAGNU_ARCHIVE)
202
DEJAGNU_URL = http://mirror.anl.gov/pub/gnu/dejagnu/$(DEJAGNU_ARCHIVE)
168
DEJAGNU_MD5 = 3df1cbca885e751e22d3ebd1ac64dc3c
203
DEJAGNU_MD5 = 3df1cbca885e751e22d3ebd1ac64dc3c
169
204
170
SUPP_TOOLS := autoconf automake libtool
205
SUPP_TOOLS := autoconf automake libtool
171
SUPP_TOOLS_TEST := dejagnu
206
SUPP_TOOLS_TEST := dejagnu
172
ALL_TOOLS := gcc gdb binutils newlib avr32patches avr32headers dfu \
207
ALL_TOOLS := gcc gdb binutils newlib avr32patches avr32headers dfu \
173
             newpatchesbinutils \
208
             newpatchesbinutils \
174
             $(SUPP_TOOLS) $(SUPP_TOOLS_TEST)
209
             $(SUPP_TOOLS) $(SUPP_TOOLS_TEST)
175
210
176
211
177
all: install-cross
212
all: install-cross
178
213
179
214
180
############ MACROS for the lazy people ;-) ############
215
############ MACROS for the lazy people ;-) ############
181
216
182
## in silent mode (make -s),, print whats ging on
217
## in silent mode (make -s),, print whats ging on
183
ifeq ($(strip $(MAKEFLAGS)),s)
218
ifeq ($(strip $(MAKEFLAGS)),s)
184
define quiet_text
219
define quiet_text
185
	@echo "$1"
220
	@echo "$1"
186
endef
221
endef
187
else
222
else
188
define quiet_text
223
define quiet_text
189
endef
224
endef
190
endif
225
endif
191
226
192
## the stamp name
227
## the stamp name
193
define name_stamp
228
define name_stamp
194
$(STAMP_DIR)/$(1)
229
$(STAMP_DIR)/$(1)
195
endef
230
endef
196
231
197
## remove a stamp
232
## remove a stamp
198
define rm_stamp
233
define rm_stamp
199
	rm -f $(STAMP_DIR)/$(1)
234
	rm -f $(STAMP_DIR)/$(1)
200
endef
235
endef
201
236
202
## remove all stamps
237
## remove all stamps
203
define rm_stamps
238
define rm_stamps
204
	rm -f $(STAMP_DIR)/*-$(1)
239
	rm -f $(STAMP_DIR)/*-$(1)
205
endef
240
endef
206
241
207
## create the stamp directory if not existing and the stamp
242
## create the stamp directory if not existing and the stamp
208
define make_stamp
243
define make_stamp
209
	@[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR)
244
	@[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR)
210
	date > $(STAMP_DIR)/$(1)
245
	date > $(STAMP_DIR)/$(1)
211
endef
246
endef
212
247
213
## delete empty directories
248
## delete empty directories
214
define del_empty-directories
249
define del_empty-directories
215
	@find . -type d -empty -not -path "*.git*" -not -path "*.svn*" -delete
250
	@find . -type d -empty -not -path "*.git*" -not -path "*.svn*" -delete
216
endef
251
endef
217
252
218
## delete all empty directories
253
## delete all empty directories
219
## need to do this several times. to remove empty sub directories
254
## need to do this several times to remove all empty sub directories
220
define del_all_empty-directories
255
define del_all_empty-directories
221
	$(call del_empty-directories)
256
	$(call del_empty-directories)
222
	$(call del_empty-directories)
257
	$(call del_empty-directories)
223
	$(call del_empty-directories)
258
	$(call del_empty-directories)
224
	$(call del_empty-directories)
259
	$(call del_empty-directories)
225
	$(call del_empty-directories)
260
	$(call del_empty-directories)
226
endef
261
endef
227
262
228
263
229
## to make the following macros more simply, we need the variables
264
## to make the following macros more simply, we need the variables
230
## with the tool name in lowercase. I could have changed the original
265
## with the tool name in lowercase. I could have changed the original
231
## definition, but I don't want to break the make convention of upper
266
## definition, but I don't want to break the make convention of upper
232
## case definitions for such user defined variables.
267
## case definitions for such user defined variables.
233
268
234
define LOWER_TOOL_VARS
269
define LOWER_TOOL_VARS
235
UP_$(1) := $(shell echo "$(1)" | tr '[a-z]' '[A-Z]')
270
UP_$(1) := $(shell echo "$(1)" | tr '[a-z]' '[A-Z]')
236
$(1)_VERSION := $$($$(UP_$(1))_VERSION)
271
$(1)_VERSION := $$($$(UP_$(1))_VERSION)
237
$(1)_ARCHIVE := $$($$(UP_$(1))_ARCHIVE)
272
$(1)_ARCHIVE := $$($$(UP_$(1))_ARCHIVE)
238
$(1)_URL := $$($$(UP_$(1))_URL)
273
$(1)_URL := $$($$(UP_$(1))_URL)
239
$(1)_MD5 := $$($$(UP_$(1))_MD5)
274
$(1)_MD5 := $$($$(UP_$(1))_MD5)
240
endef
275
endef
241
276
242
$(foreach tool,$(ALL_TOOLS),$(eval $(call LOWER_TOOL_VARS,$(tool))))
277
$(foreach tool,$(ALL_TOOLS),$(eval $(call LOWER_TOOL_VARS,$(tool))))
243
278
244
## create the download rule and force download rule
279
## create the download rule and force download rule
245
define DOWNLOAD_template
280
define DOWNLOAD_template
246
download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
281
download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
247
download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE):
282
download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE):
248
	[ -d $(DOWNLOAD_DIR) ] || mkdir -p $(DOWNLOAD_DIR)
283
	[ -d $(DOWNLOAD_DIR) ] || mkdir -p $(DOWNLOAD_DIR)
249
	cd $(DOWNLOAD_DIR) && curl -LO $$($(1)_URL)
284
	cd $(DOWNLOAD_DIR) && curl -LO $$($(1)_URL)
250
285
251
download-$(1)_TEXT := "Removing $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)"
286
download-$(1)_TEXT := "Removing $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)"
252
download-$(1)-remove:
287
download-$(1)-remove:
253
	$(call quiet_text,$$(download-$(1)_TEXT))
288
	$(call quiet_text,$$(download-$(1)_TEXT))
254
	rm -f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
289
	rm -f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
255
290
256
available_targets += download-$(1) download-$(1)-f download-$(1)-remove
291
available_targets += download-$(1) download-$(1)-f download-$(1)-remove
257
292
258
PHONY += download-$(1) download-$(1)-f download-$(1)-remove
293
PHONY += download-$(1) download-$(1)-f download-$(1)-remove
259
endef
294
endef
260
295
261
## extract commands
296
## extract commands
262
EXT_BZ2 := tar -jxf
297
EXT_BZ2 := tar -jxf
263
EXT_TGZ := tar -xf
298
EXT_TGZ := tar -xf
264
EXT_ZIP := unzip -o
299
EXT_ZIP := unzip -o
265
300
266
## create the extract rule and force extract rule
301
## create the extract rule and force extract rule
267
define EXTRACT_template
302
define EXTRACT_template
268
$(1)_extract_cmds ?= $($(2)) $$< $(3)
303
$(1)_extract_cmds ?= $($(2)) $$< $(3)
269
304
270
extract-$(1)_TEXT := "Extracting $$($(1)_ARCHIVE)"
305
extract-$(1)_TEXT := "Extracting $$($(1)_ARCHIVE)"
271
extract-$(1): $(call name_stamp,extract-$(1))
306
extract-$(1): $(call name_stamp,extract-$(1))
272
extract-$(1)-f $(call name_stamp,extract-$(1)): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
307
extract-$(1)-f $(call name_stamp,extract-$(1)): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
273
	@(rm -rf $(1)-*; \
308
	@(rm -rf $(1)-*; \
274
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
309
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
275
	[ "$$$$t1" = "$$($(1)_MD5)" ] || \
310
	[ "$$$$t1" = "$$($(1)_MD5)" ] || \
276
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
311
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
277
	$(call quiet_text,$$(extract-$(1)_TEXT))
312
	$(call quiet_text,$$(extract-$(1)_TEXT))
278
	$$($(1)_extract_cmds)
313
	$$($(1)_extract_cmds)
279
	$(call make_stamp,extract-$(1))
314
	$(call make_stamp,extract-$(1))
280
315
281
extract-$(1)-remove:
316
extract-$(1)-remove:
282
	rm -rf $(1)-*
317
	rm -rf $(1)-*
283
	$(call rm_stamp,extract-$(1))
318
	$(call rm_stamp,extract-$(1))
284
319
285
clean_extract_$(1)_rule := extract-$(1)-remove
320
clean_extract_$(1)_rule := extract-$(1)-remove
286
321
287
available_targets += extract-$(1) extract-$(1)-f extract-$(1)-remove
322
available_targets += extract-$(1) extract-$(1)-f extract-$(1)-remove
288
323
289
PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove
324
PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove
290
endef
325
endef
291
326
292
## create the patch rule
327
## create the patch rule
293
define PATCH_template
328
define PATCH_template
294
$(1)_patch_level ?= -p0
329
$(1)_patch_level ?= -p0
295
330
296
patch-$(1)_TEXT := "Patching $$($(1)_ARCHIVE)"
331
patch-$(1)_TEXT := "Patching $$($(1)_ARCHIVE)"
297
patch-$(1): $(call name_stamp,patch-$(1))
332
patch-$(1): $(call name_stamp,patch-$(1))
298
$(call name_stamp,patch-$(1)): $(call name_stamp,extract-$(1)) $(call name_stamp,extract-avr32patches) \
333
$(call name_stamp,patch-$(1)): $(call name_stamp,extract-$(1)) $(call name_stamp,extract-avr32patches) \
299
                               $(call name_stamp,extract-newpatchesbinutils)
334
                               $(call name_stamp,extract-newpatchesbinutils)
300
	$(call quiet_text,$$(patch-$(1)_TEXT))
335
	$(call quiet_text,$$(patch-$(1)_TEXT))
301
	@(pushd $(1)-$$($(1)_VERSION) ; \
336
	@(pushd $(1)-$$($(1)_VERSION) ; \
302
	for f in ../$(install_dir_avr32patches)/$(1)/*.patch; do \
337
	for f in ../$(install_dir_avr32patches)/$(1)/*.patch; do \
303
	echo "Patching using: $$$${f}" ; \
338
	echo "Patching using: $$$${f}" ; \
304
	patch -N $$($(1)_patch_level) --no-backup-if-mismatch -i $$$${f} ; \
339
	patch -N $$($(1)_patch_level) --no-backup-if-mismatch -i $$$${f} ; \
305
	if [ $$$$? -ne 0 ] ; then exit -1 ; fi ; \
340
	if [ $$$$? -ne 0 ] ; then exit -1 ; fi ; \
306
	done ; \
341
	done ; \
307
	popd)
342
	popd)
308
	$(call make_stamp,patch-$(1))
343
	$(call make_stamp,patch-$(1))
309
344
310
patch-$(1)-remove: extract-$(1)-remove
345
patch-$(1)-remove: extract-$(1)-remove
311
	$(call rm_stamp,patch-$(1))
346
	$(call rm_stamp,patch-$(1))
312
347
313
clean_patch_$(1)_rule := patch-$(1)-remove
348
clean_patch_$(1)_rule := patch-$(1)-remove
314
349
315
available_targets += patch-$(1) patch-$(1)-remove
350
available_targets += patch-$(1) patch-$(1)-remove
316
351
317
PHONY += patch-$(1) patch-$(1)-remove
352
PHONY += patch-$(1) patch-$(1)-remove
318
endef
353
endef
319
354
320
## one rule for all required support tools
355
## one rule for all required support tools
321
install-supp-tools_targets := $(foreach tool,$(SUPP_TOOLS),$(call name_stamp,install-$(tool)))
356
install-supp-tools_targets := $(foreach tool,$(SUPP_TOOLS),$(call name_stamp,install-$(tool)))
322
install-supp-tools: $(install-supp-tools_targets)
357
install-supp-tools: $(install-supp-tools_targets)
323
358
324
clean-supp-tools: $(foreach tool,$(SUPP_TOOLS),clean-$(tool))
359
clean-supp-tools: $(foreach tool,$(SUPP_TOOLS),clean-$(tool))
325
360
326
available_targets += install-supp-tools clean-supp-tools
361
available_targets += install-supp-tools clean-supp-tools
327
362
328
PHONY += install-supp-tools clean-supp-tools
363
PHONY += install-supp-tools clean-supp-tools
329
364
330
## create the regen rule
365
## create the regen rule
331
## it is used to regenerate the auto tools result files
366
## it is used to regenerate the auto tools result files
332
define REGEN_template
367
define REGEN_template
333
regen-$(1)_TEXT := "Regenerate auto tool files for $$($(1)_ARCHIVE)"
368
regen-$(1)_TEXT := "Regenerate auto tool files for $$($(1)_ARCHIVE)"
334
regen-$(1): $(call name_stamp,regen-$(1))
369
regen-$(1): $(call name_stamp,regen-$(1))
335
regen-$(1)-f $(call name_stamp,regen-$(1)): $(call name_stamp,$(2)-$(1)) \
370
regen-$(1)-f $(call name_stamp,regen-$(1)): $(call name_stamp,$(2)-$(1)) \
336
                                            $(install-supp-tools_targets)
371
                                            $(install-supp-tools_targets)
337
	$(call quiet_text,$$(regen-$(1)_TEXT))
372
	$(call quiet_text,$$(regen-$(1)_TEXT))
338
	@(pushd $(1)-$$($(1)_VERSION) ; \
373
	@(pushd $(1)-$$($(1)_VERSION) ; \
339
	PATH=$(SUPP_PREFIX)/bin:$$$${PATH} $(SUPP_PREFIX)/bin/autoreconf -v ; \
374
	PATH=$(SUPP_PREFIX)/bin:$$$${PATH} $(SUPP_PREFIX)/bin/autoreconf -v ; \
340
	for dir in $$($(1)_regen_dirs) ; do \
375
	for dir in $$($(1)_regen_dirs) ; do \
341
	  pushd $$$$dir ; \
376
	  pushd $$$$dir ; \
342
	  PATH=$(SUPP_PREFIX)/bin:$$$${PATH} $(SUPP_PREFIX)/bin/autoreconf -v ; \
377
	  PATH=$(SUPP_PREFIX)/bin:$$$${PATH} $(SUPP_PREFIX)/bin/autoreconf -v ; \
343
	  popd ; \
378
	  popd ; \
344
	done; \
379
	done; \
345
	popd)
380
	popd)
346
	$(call make_stamp,regen-$(1))
381
	$(call make_stamp,regen-$(1))
347
382
348
regen-$(1)-remove:
383
regen-$(1)-remove:
349
	$(call rm_stamp,regen-$(1))
384
	$(call rm_stamp,regen-$(1))
350
385
351
clean_regen_$(1)_rule := regen-$(1)-remove
386
clean_regen_$(1)_rule := regen-$(1)-remove
352
387
353
available_targets += regen-$(1) regen-$(1)-f regen-$(1)-remove
388
available_targets += regen-$(1) regen-$(1)-f regen-$(1)-remove
354
389
355
PHONY += regen-$(1) regen-$(1)-f regen-$(1)-remove
390
PHONY += regen-$(1) regen-$(1)-f regen-$(1)-remove
356
endef
391
endef
357
392
358
## create the configure rule and force configure rule
393
## create the configure rule and force configure rule
359
define CONF_template
394
define CONF_template
360
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)"
-
 
361
conf-$(1): $(call name_stamp,conf-$(1))
-
 
362
-
 
363
# we need configure parameters!
395
# we need configure parameters!
364
ifeq ($$(strip $$($(1)_conf_opts)),)
396
ifeq ($$(strip $$($(1)_conf_opts)),)
365
$$(error "Configure options '$(1)_conf_opts' not defined")
397
$$(error "Configure options '$(1)_conf_opts' not defined")
366
endif
398
endif
367
399
-
 
400
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)"
-
 
401
conf-$(1): $(call name_stamp,conf-$(1))
-
 
402
368
conf-$(1)-f $(call name_stamp,conf-$(1)): $(call name_stamp,$(2)-$(1)) $$($(1)_conf_deps)
403
conf-$(1)-f $(call name_stamp,conf-$(1)): $(call name_stamp,$(2)-$(1)) $$($(1)_conf_deps)
369
	@(rm -rf $(BUILD_DIR)/$(1) ; mkdir -p $(BUILD_DIR)/$(1))
404
	@(rm -rf $(BUILD_DIR)/$(1) ; mkdir -p $(BUILD_DIR)/$(1))
370
	$(call quiet_text,$$(conf-$(1)_TEXT))
405
	$(call quiet_text,$$(conf-$(1)_TEXT))
371
	cd $(BUILD_DIR)/$(1) && \
406
	cd $(BUILD_DIR)/$(1) && \
-
 
407
	$$($(1)_conf_env) \
372
	../../$(1)-$$($(1)_VERSION)/configure $$($(1)_conf_opts)
408
	../../$(1)-$$($(1)_VERSION)/configure $$($(1)_conf_opts)
373
	$(call make_stamp,conf-$(1))
409
	$(call make_stamp,conf-$(1))
374
410
375
conf-$(1)-remove:
411
conf-$(1)-remove:
376
	$(call rm_stamp,conf-$(1))
412
	$(call rm_stamp,conf-$(1))
377
413
378
clean_conf_$(1)_rule := conf-$(1)-remove
414
clean_conf_$(1)_rule := conf-$(1)-remove
379
415
380
available_targets += conf-$(1) conf-$(1)-f conf-$(1)-remove
416
available_targets += conf-$(1) conf-$(1)-f conf-$(1)-remove
381
417
382
PHONY += conf-$(1) conf-$(1)-f conf-$(1)-remove
418
PHONY += conf-$(1) conf-$(1)-f conf-$(1)-remove
383
endef
419
endef
384
420
385
## create the build rule and force build rule
421
## create the build rule and force build rule
386
define BUILD_template
422
define BUILD_template
387
build-$(1): $(call name_stamp,build-$(1))
423
build-$(1): $(call name_stamp,build-$(1))
388
build-$(1)-f: build-$(1)-clean build-$(1)
424
build-$(1)-f: build-$(1)-clean build-$(1)
389
425
390
# default commands overrideable
426
# default commands overrideable
391
$(1)_build_cmds ?= $(MAKE) -j$(PROCS)
427
$(1)_build_cmds ?= $(MAKE) -j$(PROCS)
392
$(1)_build_clean_cmds ?= $(MAKE) clean
428
$(1)_build_clean_cmds ?= $(MAKE) clean
393
429
394
build-$(1)_TEXT := "Building $(1) $$($(1)_VERSION)"
430
build-$(1)_TEXT := "Building $(1) $$($(1)_VERSION)"
395
$(call name_stamp,build-$(1)): $(call name_stamp,conf-$(1))
431
$(call name_stamp,build-$(1)): $(call name_stamp,conf-$(1))
396
	$(call quiet_text,$$(build-$(1)_TEXT))
432
	$(call quiet_text,$$(build-$(1)_TEXT))
397
	cd $(BUILD_DIR)/$(1) && \
433
	cd $(BUILD_DIR)/$(1) && \
-
 
434
	$$($(1)_build_env) \
398
	$$($(1)_build_cmds)
435
	$$($(1)_build_cmds)
399
	$(call make_stamp,build-$(1))
436
	$(call make_stamp,build-$(1))
400
437
401
build-$(1)-clean_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
438
build-$(1)-clean_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
402
build-$(1)-clean:
439
build-$(1)-clean:
403
	$(call quiet_text,$$(build-$(1)-clean_TEXT))
440
	$(call quiet_text,$$(build-$(1)-clean_TEXT))
404
	cd $(BUILD_DIR)/$(1) && \
441
	cd $(BUILD_DIR)/$(1) && \
405
	$$($(1)_build_clean_cmds)
442
	$$($(1)_build_clean_cmds)
406
	$(call rm_stamp,build-$(1))
443
	$(call rm_stamp,build-$(1))
407
444
408
build-$(1)-remove:
445
build-$(1)-remove:
409
	rm -rf $(BUILD_DIR)/$(1)
446
	rm -rf $(BUILD_DIR)/$(1)
410
	$(call rm_stamp,build-$(1))
447
	$(call rm_stamp,build-$(1))
411
448
412
clean_build_$(1)_rule := build-$(1)-remove
449
clean_build_$(1)_rule := build-$(1)-remove
413
450
414
available_targets += build-$(1) build-$(1)-f build-$(1)-clean build-$(1)-remove
451
available_targets += build-$(1) build-$(1)-f build-$(1)-clean build-$(1)-remove
415
452
416
PHONY += build-$(1) build-$(1)-f build-$(1)-clean build-$(1)-remove
453
PHONY += build-$(1) build-$(1)-f build-$(1)-clean build-$(1)-remove
417
endef
454
endef
418
455
419
## create the install rule and force install rule
456
## create the install rule and force install rule
420
define INSTALL_template
457
define INSTALL_template
421
install-$(1)_TEXT := "Installing $(1) $$($(1)_VERSION)"
458
install-$(1)_TEXT := "Installing $(1) $$($(1)_VERSION)"
422
install-$(1): $(call name_stamp,install-$(1))
459
install-$(1): $(call name_stamp,install-$(1))
423
install-$(1)-f $(call name_stamp,install-$(1)): $(call name_stamp,build-$(1))
460
install-$(1)-f $(call name_stamp,install-$(1)): $(call name_stamp,build-$(1))
424
	$(call quiet_text,$$(install-$(1)_TEXT))
461
	$(call quiet_text,$$(install-$(1)_TEXT))
425
	cd $(BUILD_DIR)/$(1) && \
462
	cd $(BUILD_DIR)/$(1) && \
426
	$(MAKE) install
463
	$(MAKE) install
427
	$(call make_stamp,install-$(1))
464
	$(call make_stamp,install-$(1))
428
465
429
uninstall-$(1)_TEXT := "Uninstalling $(1) $$($(1)_VERSION)"
466
uninstall-$(1)_TEXT := "Uninstalling $(1) $$($(1)_VERSION)"
430
uninstall-$(1):
467
uninstall-$(1):
431
	$(call quiet_text,$$(uninstall-$(1)_TEXT))
468
	$(call quiet_text,$$(uninstall-$(1)_TEXT))
432
	[ -f $(BUILD_DIR)/$(1)/Makefile ] && \
469
	[ -f $(BUILD_DIR)/$(1)/Makefile ] && \
433
	[ -f $(call name_stamp,install-$(1)) ] && \
470
	[ -f $(call name_stamp,install-$(1)) ] && \
434
	cd $(BUILD_DIR)/$(1) && \
471
	cd $(BUILD_DIR)/$(1) && \
435
	$(MAKE) uninstall || true
472
	$(MAKE) uninstall || true
436
	$(call rm_stamp,install-$(1))
473
	$(call rm_stamp,install-$(1))
437
474
438
clean_uninstall_$(1)_rule := uninstall-$(1)
475
clean_uninstall_$(1)_rule := uninstall-$(1)
439
476
440
available_targets += install-$(1) install-$(1)-f uninstall-$(1)
477
available_targets += install-$(1) install-$(1)-f uninstall-$(1)
441
478
442
PHONY += install-$(1) install-$(1)-f uninstall-$(1)
479
PHONY += install-$(1) install-$(1)-f uninstall-$(1)
443
endef
480
endef
444
481
445
## create the clean rule and realclean rule
482
## create the clean rule and realclean rule
446
define CLEAN_template
483
define CLEAN_template
447
clean-$(1)_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
484
clean-$(1)_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
448
clean-$(1)-text:
485
clean-$(1)-text:
449
	$(call quiet_text,$$(clean-$(1)_TEXT))
486
	$(call quiet_text,$$(clean-$(1)_TEXT))
450
487
451
clean-$(1): clean-$(1)-text $$(clean_uninstall_$(1)_rule) $$(clean_extract_$(1)_rule) \
488
clean-$(1): clean-$(1)-text $$(clean_uninstall_$(1)_rule) $$(clean_extract_$(1)_rule) \
452
            $$(clean_patch_$(1)_rule) $$(clean_regen_$(1)_rule) $$(clean_build_$(1)_rule) \
489
            $$(clean_patch_$(1)_rule) $$(clean_regen_$(1)_rule) $$(clean_build_$(1)_rule) \
453
            $$(clean_conf_$(1)_rule)
490
            $$(clean_conf_$(1)_rule)
454
	$(call del_all_empty-directories)
491
	$(call del_all_empty-directories)
455
492
456
clean_rules += clean-$(1)
493
clean_rules += clean-$(1)
457
494
458
realclean-$(1): clean-$(1) download-$(1)-remove
495
realclean-$(1): clean-$(1) download-$(1)-remove
459
	$(call del_all_empty-directories)
496
	$(call del_all_empty-directories)
460
497
461
realclean_rules += realclean-$(1)
498
realclean_rules += realclean-$(1)
462
499
463
available_targets += clean-$(1) realclean-$(1)
500
available_targets += clean-$(1) realclean-$(1)
464
501
465
PHONY += clean-$(1) realclean-$(1) clean-$(1)-text
502
PHONY += clean-$(1) realclean-$(1) clean-$(1)-text
466
endef
503
endef
467
504
468
505
469
############# SUPP: AUTOCONF ############
506
############# SUPP: AUTOCONF ############
470
507
471
$(eval $(call DOWNLOAD_template,autoconf))
508
$(eval $(call DOWNLOAD_template,autoconf))
472
$(eval $(call EXTRACT_template,autoconf,EXT_BZ2))
509
$(eval $(call EXTRACT_template,autoconf,EXT_BZ2))
473
autoconf_conf_opts := --prefix="$(SUPP_PREFIX)"
510
autoconf_conf_opts := --prefix="$(SUPP_PREFIX)"
474
$(eval $(call CONF_template,autoconf,extract))
511
$(eval $(call CONF_template,autoconf,extract))
475
$(eval $(call BUILD_template,autoconf))
512
$(eval $(call BUILD_template,autoconf))
476
$(eval $(call INSTALL_template,autoconf))
513
$(eval $(call INSTALL_template,autoconf))
477
$(eval $(call CLEAN_template,autoconf))
514
$(eval $(call CLEAN_template,autoconf))
478
515
479
516
480
############ SUPP: AUTOMAKE ############
517
############ SUPP: AUTOMAKE ############
481
518
482
$(eval $(call DOWNLOAD_template,automake))
519
$(eval $(call DOWNLOAD_template,automake))
483
$(eval $(call EXTRACT_template,automake,EXT_BZ2))
520
$(eval $(call EXTRACT_template,automake,EXT_BZ2))
484
automake_conf_opts := --prefix="$(SUPP_PREFIX)"
521
automake_conf_opts := --prefix="$(SUPP_PREFIX)"
485
# automake needs the new autoconf allready installed
522
# automake needs the new autoconf allready installed
486
automake_conf_deps := $(call name_stamp,install-autoconf)
523
automake_conf_deps := $(call name_stamp,install-autoconf)
487
$(eval $(call CONF_template,automake,extract))
524
$(eval $(call CONF_template,automake,extract))
488
$(eval $(call BUILD_template,automake))
525
$(eval $(call BUILD_template,automake))
489
$(eval $(call INSTALL_template,automake))
526
$(eval $(call INSTALL_template,automake))
490
$(eval $(call CLEAN_template,automake))
527
$(eval $(call CLEAN_template,automake))
491
528
492
529
493
############ SUPP: LIBTOOL ############
530
############ SUPP: LIBTOOL ############
494
531
495
$(eval $(call DOWNLOAD_template,libtool))
532
$(eval $(call DOWNLOAD_template,libtool))
496
$(eval $(call EXTRACT_template,libtool,EXT_TGZ))
533
$(eval $(call EXTRACT_template,libtool,EXT_TGZ))
497
libtool_conf_opts := --prefix="$(SUPP_PREFIX)"
534
libtool_conf_opts := --prefix="$(SUPP_PREFIX)"
498
# libtool needs the new autoconf/automake allready installed
535
# libtool needs the new autoconf/automake allready installed
499
libtool_conf_deps := $(call name_stamp,install-autoconf) \
536
libtool_conf_deps := $(call name_stamp,install-autoconf) \
500
                     $(call name_stamp,install-automake)
537
                     $(call name_stamp,install-automake)
501
$(eval $(call CONF_template,libtool,extract))
538
$(eval $(call CONF_template,libtool,extract))
502
$(eval $(call BUILD_template,libtool))
539
$(eval $(call BUILD_template,libtool))
503
$(eval $(call INSTALL_template,libtool))
540
$(eval $(call INSTALL_template,libtool))
504
$(eval $(call CLEAN_template,libtool))
541
$(eval $(call CLEAN_template,libtool))
505
542
506
543
507
############ SUPP-TEST: DEJAGNU ############
544
############ SUPP-TEST: DEJAGNU ############
508
545
509
$(eval $(call DOWNLOAD_template,dejagnu))
546
$(eval $(call DOWNLOAD_template,dejagnu))
510
$(eval $(call EXTRACT_template,dejagnu,EXT_TGZ))
547
$(eval $(call EXTRACT_template,dejagnu,EXT_TGZ))
511
dejagnu_conf_opts := --prefix="$(SUPP_PREFIX)"
548
dejagnu_conf_opts := --prefix="$(SUPP_PREFIX)"
512
# dejagnu needs the new autoconf/automake allready installed
549
# dejagnu needs the new autoconf/automake allready installed
513
dejagnu_conf_deps := $(call name_stamp,install-autoconf) \
550
dejagnu_conf_deps := $(call name_stamp,install-autoconf) \
514
                     $(call name_stamp,install-automake)
551
                     $(call name_stamp,install-automake)
515
$(eval $(call CONF_template,dejagnu,extract))
552
$(eval $(call CONF_template,dejagnu,extract))
516
$(eval $(call BUILD_template,dejagnu))
553
$(eval $(call BUILD_template,dejagnu))
517
$(eval $(call INSTALL_template,dejagnu))
554
$(eval $(call INSTALL_template,dejagnu))
518
$(eval $(call CLEAN_template,dejagnu))
555
$(eval $(call CLEAN_template,dejagnu))
519
556
520
557
521
############# AVR32 PATCHES ############
558
############# AVR32 PATCHES ############
522
559
523
$(eval $(call DOWNLOAD_template,avr32patches))
560
$(eval $(call DOWNLOAD_template,avr32patches))
524
$(eval $(call EXTRACT_template,avr32patches,EXT_ZIP))
561
$(eval $(call EXTRACT_template,avr32patches,EXT_ZIP))
525
562
526
## use the uninstall-XXX rule to remove the patches directory
563
## use the uninstall-XXX rule to remove the patches directory
527
PHONY += uninstall-avr32patches
564
PHONY += uninstall-avr32patches
528
uninstall-avr32patches:
565
uninstall-avr32patches:
529
	rm -rf $(install_dir_avr32patches)
566
	rm -rf $(install_dir_avr32patches)
530
567
531
clean_uninstall_avr32patches_rule = uninstall-avr32patches
568
clean_uninstall_avr32patches_rule = uninstall-avr32patches
532
569
533
$(eval $(call CLEAN_template,avr32patches))
570
$(eval $(call CLEAN_template,avr32patches))
534
571
535
572
536
############# NEWPATCHESBINUTILS ############
573
############# NEWPATCHESBINUTILS ############
537
574
538
$(eval $(call DOWNLOAD_template,newpatchesbinutils))
575
$(eval $(call DOWNLOAD_template,newpatchesbinutils))
539
newpatchesbinutils_extract_cmds := \
576
newpatchesbinutils_extract_cmds := \
540
@([ -d $(install_dir_newpatchesbinutils) ] && \
577
@([ -d $(install_dir_newpatchesbinutils) ] && \
541
  mv $(install_dir_newpatchesbinutils) $(install_dir_newpatchesbinutils).x ; \
578
  mv $(install_dir_newpatchesbinutils) $(install_dir_newpatchesbinutils).x ; \
542
  mkdir -p $(install_dir_newpatchesbinutils) ; \
579
  mkdir -p $(install_dir_newpatchesbinutils) ; \
543
  cp $(DOWNLOAD_DIR)/$(NEWPATCHESBINUTILS_ARCHIVE) $(install_dir_newpatchesbinutils) \
580
  cp $(DOWNLOAD_DIR)/$(NEWPATCHESBINUTILS_ARCHIVE) $(install_dir_newpatchesbinutils) \
544
)
581
)
545
$(eval $(call EXTRACT_template,newpatchesbinutils))
582
$(eval $(call EXTRACT_template,newpatchesbinutils))
546
583
547
## use the uninstall-XXX rule to remove the patches directory
584
## use the uninstall-XXX rule to remove the patches directory
548
PHONY += uninstall-avr32patches
585
PHONY += uninstall-avr32patches
549
uninstall-newpatchesbinutils:
586
uninstall-newpatchesbinutils:
550
	rm -rf $(install_dir_newpatchesbinutils)
587
	rm -rf $(install_dir_newpatchesbinutils)
551
588
552
clean_uninstall_newpatchesbinutils_rule = uninstall-newpatchesbinutils
589
clean_uninstall_newpatchesbinutils_rule = uninstall-newpatchesbinutils
553
590
554
$(eval $(call CLEAN_template,newpatchesbinutils))
591
$(eval $(call CLEAN_template,newpatchesbinutils))
555
592
556
593
557
############# AVR32 HEADERS ############
594
############# AVR32 HEADERS ############
558
$(eval $(call DOWNLOAD_template,avr32headers))
595
$(eval $(call DOWNLOAD_template,avr32headers))
559
596
560
###### FIXME: Need to add a dependency to "stamps/install-final-gcc"
597
###### FIXME: Need to add a dependency to "stamps/install-final-gcc"
561
install_path_avr32headers := $(PREFIX)/$(TARGET)/include
598
install_path_avr32headers := $(PREFIX)/$(TARGET)/include
562
avr32headers_unzip_opt := -d "$(install_path_avr32headers)"
599
avr32headers_unzip_opt := -d "$(install_path_avr32headers)"
563
$(eval $(call EXTRACT_template,avr32headers,EXT_ZIP,$(avr32headers_unzip_opt)))
600
$(eval $(call EXTRACT_template,avr32headers,EXT_ZIP,$(avr32headers_unzip_opt)))
564
601
565
## use the uninstall-XXX rule to remove the patches directory
602
## use the uninstall-XXX rule to remove the patches directory
566
install_dir_avr32headers := $(install_path_avr32headers)/avr32
603
install_dir_avr32headers := $(install_path_avr32headers)/avr32
567
PHONY += uninstall-avr32headers
604
PHONY += uninstall-avr32headers
568
uninstall-avr32headers:
605
uninstall-avr32headers:
569
	rm -rf $(install_dir_avr32headers)
606
	rm -rf $(install_dir_avr32headers)
570
607
571
clean_uninstall_avr32headers_rule = uninstall-avr32headers
608
clean_uninstall_avr32headers_rule = uninstall-avr32headers
572
609
573
$(eval $(call CLEAN_template,avr32headers))
610
$(eval $(call CLEAN_template,avr32headers))
574
611
575
612
576
################ BINUTILS ################
613
################ BINUTILS ################
577
614
578
$(eval $(call DOWNLOAD_template,binutils))
615
$(eval $(call DOWNLOAD_template,binutils))
579
$(eval $(call EXTRACT_template,binutils,EXT_BZ2))
616
$(eval $(call EXTRACT_template,binutils,EXT_BZ2))
580
binutils_patch_level := -p1
617
#binutils_patch_level := -p1
581
$(eval $(call PATCH_template,binutils))
618
$(eval $(call PATCH_template,binutils))
582
binutils_regen_dirs := bfd opcodes binutils gas ld
619
binutils_regen_dirs := bfd opcodes binutils gas ld
583
$(eval $(call REGEN_template,binutils,patch))
620
$(eval $(call REGEN_template,binutils,patch))
584
621
585
ifneq ($(M_MODE),no)
622
ifneq ($(M_MODE),no)
586
binutils_maintainer_mode := --enable-maintainer-mode
623
binutils_maintainer_mode := --enable-maintainer-mode
587
endif
624
endif
588
625
-
 
626
# do not add a ' ' between after ":="
589
ifneq ($(BINUTILS_REGEN),no)
627
ifneq ($(BINUTILS_REGEN),no)
590
binutils_conf_depend :=regen
628
binutils_conf_depend :=regen
591
else	
629
else	
592
binutils_conf_depend :=patch
630
binutils_conf_depend :=patch
593
endif
631
endif
594
632
595
binutils_conf_opts := \
633
binutils_conf_opts := \
596
  $(binutils_maintainer_mode) \
634
  $(binutils_maintainer_mode) \
597
  --prefix="$(PREFIX)" --target=$(TARGET) --disable-nls \
635
  --prefix="$(PREFIX)" --target=$(TARGET) --disable-nls \
598
  --disable-shared --disable-werror \
636
  --disable-shared --disable-werror \
599
  --enable-ld=yes --enable-gold=no \
637
  --enable-ld=yes --enable-gold=no \
600
  --with-pkgversion=$(PKG_VERSION) \
638
  --with-pkgversion=$(PKG_VERSION) \
601
  --with-sysroot="$(PREFIX)/$(TARGET)"
639
  --with-sysroot="$(PREFIX)/$(TARGET)"
602
#  --with-bugurl=$(BUG_URL)
640
#  --with-bugurl=$(BUG_URL)
603
-
 
604
$(eval $(call CONF_template,binutils,$(binutils_conf_depend)))
641
$(eval $(call CONF_template,binutils,$(binutils_conf_depend)))
-
 
642
-
 
643
ifneq ($(FULL_STATIC),no)
-
 
644
binutils_fulls_static := AM_LDFLAGS=-all-static
-
 
645
endif
605
#binutils_build_cmds := ???
646
#binutils_build_cmds := ???
606
#binutils_build_clean_cmds := ???
647
#binutils_build_clean_cmds := ???
-
 
648
binutils_build_env := $(binutils_fulls_static)
607
$(eval $(call BUILD_template,binutils))
649
$(eval $(call BUILD_template,binutils))
608
$(eval $(call INSTALL_template,binutils))
650
$(eval $(call INSTALL_template,binutils))
609
$(eval $(call CLEAN_template,binutils))
651
$(eval $(call CLEAN_template,binutils))
610
652
611
653
612
.PHONY: $(PHONY)
654
.PHONY: $(PHONY)
613
655
614
656
615
657
616
658
617
.PHONY: tst tst2 tst3
659
.PHONY: tst
618
tst:
660
tst:
619
	@echo "PREFIX=$(PREFIX)"
661
	@echo "PREFIX=$(PREFIX)"
620
	@echo "PKG_VERSION=$(PKG_VERSION)"
662
	@echo "PKG_VERSION=$(PKG_VERSION)"
621
	@echo "BUG_URL=$(BUG_URL)"
663
	@echo "BUG_URL=$(BUG_URL)"
622
tst2:
-
 
623
	$(call make_stamp,JES)
-
 
624
tst3:
-
 
625
	$(call rm_stamp,JES)
-
 
626
664
627
.PHONY: help
665
.PHONY: help
628
help:
666
help:
629
	@echo ""
667
	@echo ""
630
	@echo "The following targets are available:"
668
	@echo "The following targets are available:"
631
	@echo ""
669
	@echo ""
632
	@echo "download-XXX	: download the required package"
670
	@echo "download-XXX	: download the required package"
633
	@echo "extract-XXX	: extract the downloaded package"
671
	@echo "extract-XXX	: extract the downloaded package"
634
	@echo "conf-XXX	: configure the extracted package"
672
	@echo "conf-XXX	: configure the extracted package"
635
	@echo "build-XXX	: build the configured package"
673
	@echo "build-XXX	: build the configured package"
636
	@echo "install-XXX	: install the build package"
674
	@echo "install-XXX	: install the build package"
637
	@echo "uninstall-XXX	: uninstall the installed package"
675
	@echo "uninstall-XXX	: uninstall the installed package"
638
	@echo "clean-XXX	: clean the package source and build tree"
676
	@echo "clean-XXX	: clean the package source and build tree"
639
	@echo "realclean-XXX	: same as clean-XXX, but remove the downloaded"
677
	@echo "realclean-XXX	: same as clean-XXX, but remove the downloaded"
640
	@echo "		  package, too"
678
	@echo "		  package, too"
641
	@echo ""
679
	@echo ""
642
	@echo "XXX can be one of the following:"
680
	@echo "XXX can be one of the following:"
643
	@echo "$(ALL_TOOLS)"
681
	@echo "$(ALL_TOOLS)"
644
	@echo "supp-tools"
682
	@echo "supp-tools"
645
	@echo ""
683
	@echo ""
646
	@echo "The above targets will be executed in the right order and only if"
684
	@echo "The above targets will be executed in the right order and only if"
647
	@echo "they need to be be really built. If you want to rebuild one of them"
685
	@echo "they need to be be really built. If you want to rebuild one of them"
648
	@echo "manualy, you can use the aaaa-XXX-f target (e.g.: build-autoconf-f,"
686
	@echo "manualy, you can use the aaaa-XXX-f target (e.g.: build-autoconf-f,"
649
	@echo "download-automake-f). Please note, that not all steps are available for"
687
	@echo "download-automake-f). Please note, that not all steps are available for"
650
	@echo "all tools (e.g.: install-avr32patches is not available)."
688
	@echo "all tools (e.g.: install-avr32patches is not available)."
651
	@echo ""
689
	@echo ""
652
	@echo "clean		: clean all; execute all clean-XXX rules"
690
	@echo "clean		: clean all; execute all clean-XXX rules"
653
	@echo "realclean	: same as clean, but remove all downloaded"
691
	@echo "realclean	: same as clean, but remove all downloaded"
654
	@echo "                  packages, too (execute all realclean-XXX rules)"
692
	@echo "                  packages, too (execute all realclean-XXX rules)"
655
	@echo ""
693
	@echo ""
656
	@echo "help		: this inforamtion"
694
	@echo "help		: this inforamtion"
657
	@echo "helpx		: this inforamtion + available targets"
695
	@echo "helpx		: this inforamtion + available targets"
658
	@echo ""
696
	@echo ""
659
	@echo "The installation prefix can be set by"
697
	@echo "The installation prefix can be set by"
660
	@echo " PREFIX=.... make aaa-XXX"
698
	@echo " PREFIX=.... make aaa-XXX"
661
	@echo "And the package version with"
699
	@echo "And the package version with"
662
	@echo " PKG_VERSION=\"AVR 32 bit GNU Toolchain-XXX\""
700
	@echo " PKG_VERSION=\"AVR 32 bit GNU Toolchain-XXX\""
663
	@echo ""
701
	@echo ""
-
 
702
	@echo "Build a full static release with"
-
 
703
	@echo " RELEASE_VERSION=0.1.0"
-
 
704
	@echo "The prefix for the release can changed with"
-
 
705
	@echo " PREFIX_RELEASE=/usr/local/avr/avr32-tools"
-
 
706
	@echo ""
664
	@echo "Maintainers may use"
707
	@echo "Maintainers may use"
665
	@echo " M_MODE=y or BINUTILS_REGEN=y"
708
	@echo " M_MODE=y, BINUTILS_REGEN=y, FULL_STATIC=y"
666
	@echo "Please have a look to the Makefile for details"
709
	@echo "Please have a look to the Makefile for details"
667
	@echo ""
710
	@echo ""
668
711
-
 
712
# do not remove the empty line, will add the required \n
669
define print_target
713
define print_target
670
	@echo "$(1)"
714
	@echo "$(1)"
671
715
672
endef
716
endef
673
717
674
.PHONY: helpx
718
.PHONY: helpx
675
helpx: help
719
helpx: help
676
	@echo "Available targets:"
720
	@echo "Available targets:"
677
	$(foreach target,$(available_targets),$(call print_target,$(target)))
721
	$(foreach target,$(available_targets),$(call print_target,$(target)))
678
	@echo ""
722
	@echo ""
679
723
680
.PHONY: install-note
724
.PHONY: install-note
681
install-note: install-tools
725
install-note: install-tools
682
	@echo ""
726
	@echo ""
683
	@echo "====== INSTALLATION NOTE ======"
727
	@echo "====== INSTALLATION NOTE ======"
684
	@echo "Your tools have now been installed at the following prefix:"
728
	@echo "Your tools have now been installed at the following prefix:"
685
	@echo "$(PREFIX)"
729
	@echo "$(PREFIX)"
686
	@echo
730
	@echo
687
	@echo "Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:"
731
	@echo "Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:"
688
	@echo '  export PATH="$(PREFIX)/bin:$$PATH"'
732
	@echo '  export PATH="$(PREFIX)/bin:$$PATH"'
689
	@echo
733
	@echo
690
734
691
.PHONY: install-tools
735
.PHONY: install-tools
692
install-tools: install-binutils
736
install-tools: install-binutils
693
# FIXME: other currently not finished
737
# FIXME: other currently not finished
694
# install-final-gcc install-newlib install-headers
738
# install-final-gcc install-newlib install-headers
695
739
696
.PHONY: install-cross
740
.PHONY: install-cross
697
install-cross: install-tools install-note
741
install-cross: install-tools install-note
698
742
699
.PHONY : clean realclean
743
.PHONY : clean realclean
700
clean: $(clean_rules)
744
clean: $(clean_rules)
701
745
702
realclean: $(realclean_rules)
746
realclean: $(realclean_rules)
703
747
704
748
705
749
706
#################################################################
750
#################################################################
707
#################################################################
751
#################################################################
708
####                                                        ######
752
####                                                        ######
709
####                                                        ######
753
####                                                        ######
710
####                                                        ######
754
####                                                        ######
711
####      FROM HERE ON OLD CODE OF ORIGINAL MAKEFILE        ######
755
####      FROM HERE ON OLD CODE OF ORIGINAL MAKEFILE        ######
712
####      COMPLETELY UNSUPPORTED AND FOR PATTERN FOR        ######
756
####      COMPLETELY UNSUPPORTED AND FOR PATTERN FOR        ######
713
####      ADDITIONAL WORK ONLY                              ######
757
####      ADDITIONAL WORK ONLY                              ######
714
####                                                        ######
758
####                                                        ######
715
####                                                        ######
759
####                                                        ######
716
####                                                        ######
760
####                                                        ######
717
#################################################################
761
#################################################################
718
#################################################################
762
#################################################################
719
763
720
764
721
765
722
766
723
############ SUPP: AUTOMAKE ############
767
############ SUPP: AUTOMAKE ############
724
768
725
##.PHONY: download-automake download-automake-force
769
##.PHONY: download-automake download-automake-force
726
##download-automake: downloads/$(AUTOMAKE_ARCHIVE)
770
##download-automake: downloads/$(AUTOMAKE_ARCHIVE)
727
##download-automake-force downloads/$(AUTOMAKE_ARCHIVE):
771
##download-automake-force downloads/$(AUTOMAKE_ARCHIVE):
728
##	[ -d downloads ] || mkdir downloads ;
772
##	[ -d downloads ] || mkdir downloads ;
729
##	cd downloads && curl -LO $(AUTOMAKE_URL)
773
##	cd downloads && curl -LO $(AUTOMAKE_URL)
730
774
731
##.PHONY: extract-automake extract-automake-force
775
##.PHONY: extract-automake extract-automake-force
732
##extract-automake: stamps/extract-automake
776
##extract-automake: stamps/extract-automake
733
##extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE)
777
##extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE)
734
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
778
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
735
##	[ "$$t1" = "$(AUTOMAKE_MD5)" ] || \
779
##	[ "$$t1" = "$(AUTOMAKE_MD5)" ] || \
736
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
780
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
737
##	tar -jxf $< ;
781
##	tar -jxf $< ;
738
##	[ -d stamps ] || mkdir stamps ;
782
##	[ -d stamps ] || mkdir stamps ;
739
##	touch stamps/extract-automake;
783
##	touch stamps/extract-automake;
740
784
741
##.PHONY: build-automake build-automake-force
785
##.PHONY: build-automake build-automake-force
742
##build-automake: stamps/build-automake
786
##build-automake: stamps/build-automake
743
##build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf
787
##build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf
744
##	mkdir -p build/automake && cd build/automake && \
788
##	mkdir -p build/automake && cd build/automake && \
745
##	../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
789
##	../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
746
##	$(MAKE) -j$(PROCS)
790
##	$(MAKE) -j$(PROCS)
747
##	[ -d stamps ] || mkdir stamps
791
##	[ -d stamps ] || mkdir stamps
748
##	touch stamps/build-automake;
792
##	touch stamps/build-automake;
749
793
750
##.PHONY: install-automake install-automake-force
794
##.PHONY: install-automake install-automake-force
751
##install-automake: stamps/install-automake
795
##install-automake: stamps/install-automake
752
##install-automake-force stamps/install-automake: stamps/build-automake
796
##install-automake-force stamps/install-automake: stamps/build-automake
753
##	cd build/automake && \
797
##	cd build/automake && \
754
##	$(MAKE) install
798
##	$(MAKE) install
755
##	[ -d stamps ] || mkdir stamps
799
##	[ -d stamps ] || mkdir stamps
756
##	touch stamps/install-automake;
800
##	touch stamps/install-automake;
757
801
758
##.PHONY: clean-automake
802
##.PHONY: clean-automake
759
##clean-automake:
803
##clean-automake:
760
##	rm -rf build/automake stamps/*-automake automake-*
804
##	rm -rf build/automake stamps/*-automake automake-*
761
805
762
##.PHONY: realclean-automake
806
##.PHONY: realclean-automake
763
##realclean-automake: clean-automake
807
##realclean-automake: clean-automake
764
##	rm downloads/$(AUTOMAKE_ARCHIVE)
808
##	rm downloads/$(AUTOMAKE_ARCHIVE)
765
809
766
810
767
############# AVR32 PATCHES ############
811
############# AVR32 PATCHES ############
768
812
769
##.PHONY: download-avr32patches download-avr32patches-force
813
##.PHONY: download-avr32patches download-avr32patches-force
770
##download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
814
##download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
771
##download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE):
815
##download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE):
772
##	cd downloads && curl -LO $(AVR32PATCHES_URL)
816
##	cd downloads && curl -LO $(AVR32PATCHES_URL)
773
817
774
##.PHONY: extract-avr32patches extract-avr32patches-force
818
##.PHONY: extract-avr32patches extract-avr32patches-force
775
##extract-avr32patches: stamps/extract-avr32patches
819
##extract-avr32patches: stamps/extract-avr32patches
776
##extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
820
##extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
777
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
821
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
778
##	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
822
##	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
779
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
823
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
780
##	unzip -o $<
824
##	unzip -o $<
781
##	[ -d stamps ] || mkdir stamps
825
##	[ -d stamps ] || mkdir stamps
782
##	touch stamps/extract-avr32patches;
826
##	touch stamps/extract-avr32patches;
783
827
784
##.PHONY: clean-avr32patches
828
##.PHONY: clean-avr32patches
785
##clean-avr32patches:
829
##clean-avr32patches:
786
##	rm -rf stamps/*-avr32patches source
830
##	rm -rf stamps/*-avr32patches source
787
831
788
##.PHONY: realclean-avr32patches
832
##.PHONY: realclean-avr32patches
789
##realclean-avr32patches: clean-avr32patches
833
##realclean-avr32patches: clean-avr32patches
790
##	rm downloads/$(AVR32PATCHES_ARCHIVE)
834
##	rm downloads/$(AVR32PATCHES_ARCHIVE)
791
835
792
836
793
############# AVR32 HEADERS ############
837
############# AVR32 HEADERS ############
794
838
795
##.PHONY: download-avr32headers download-avr32headers-force
839
##.PHONY: download-avr32headers download-avr32headers-force
796
##download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE)
840
##download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE)
797
##download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE):
841
##download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE):
798
##	cd downloads && curl -LO $(AVR32HEADERS_URL)
842
##	cd downloads && curl -LO $(AVR32HEADERS_URL)
799
843
800
##.PHONY: install-headers install-headers-force
844
##.PHONY: install-headers install-headers-force
801
##install-headers: stamps/install-headers
845
##install-headers: stamps/install-headers
802
##install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
846
##install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
803
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
847
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
804
##	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
848
##	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
805
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
849
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
806
##	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
850
##	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
807
##	[ -d stamps ] || mkdir stamps
851
##	[ -d stamps ] || mkdir stamps
808
##	touch stamps/install-headers;
852
##	touch stamps/install-headers;
809
853
810
##.PHONY: clean-headers
854
##.PHONY: clean-headers
811
##clean-headers:
855
##clean-headers:
812
##	rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32
856
##	rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32
813
857
814
##.PHONY: realclean-headers
858
##.PHONY: realclean-headers
815
##realclean-headers: clean-headers
859
##realclean-headers: clean-headers
816
##	rm downloads/$(AVR32HEADERS_ARCHIVE)
860
##	rm downloads/$(AVR32HEADERS_ARCHIVE)
817
861
818
862
819
################ NEWLIB ################
863
################ NEWLIB ################
820
864
821
.PHONY: download-newlib download-newlib-force
865
.PHONY: download-newlib download-newlib-force
822
download-newlib: downloads/$(NEWLIB_ARCHIVE)
866
download-newlib: downloads/$(NEWLIB_ARCHIVE)
823
download-newlib-force downloads/$(NEWLIB_ARCHIVE):
867
download-newlib-force downloads/$(NEWLIB_ARCHIVE):
824
	[ -d downloads ] || mkdir downloads ;
868
	[ -d downloads ] || mkdir downloads ;
825
	cd downloads && curl -LO $(NEWLIB_URL)
869
	cd downloads && curl -LO $(NEWLIB_URL)
826
870
827
.PHONY: extract-newlib extract-newlib-force
871
.PHONY: extract-newlib extract-newlib-force
828
extract-newlib: stamps/extract-newlib
872
extract-newlib: stamps/extract-newlib
829
extract-newlib-force stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE)
873
extract-newlib-force stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE)
830
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
874
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
831
	[ "$$t1" = "$(NEWLIB_MD5)" ] || \
875
	[ "$$t1" = "$(NEWLIB_MD5)" ] || \
832
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
876
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
833
	tar -xf $<
877
	tar -xf $<
834
	[ -d stamps ] || mkdir stamps
878
	[ -d stamps ] || mkdir stamps
835
	touch stamps/extract-newlib;
879
	touch stamps/extract-newlib;
836
880
837
881
838
.PHONY: patch-newlib patch-newlib-force
882
.PHONY: patch-newlib patch-newlib-force
839
patch-newlib: stamps/patch-newlib
883
patch-newlib: stamps/patch-newlib
840
patch-newlib-force stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches
884
patch-newlib-force stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches
841
	pushd newlib-$(NEWLIB_VERSION) ; \
885
	pushd newlib-$(NEWLIB_VERSION) ; \
842
	for f in ../source/avr32/newlib/*.patch; do \
886
	for f in ../source/avr32/newlib/*.patch; do \
843
	patch -N -p0 <$${f} ; \
887
	patch -N -p0 <$${f} ; \
844
	done ; \
888
	done ; \
845
	popd ;
889
	popd ;
846
	[ -d stamps ] || mkdir stamps
890
	[ -d stamps ] || mkdir stamps
847
	touch stamps/patch-newlib;
891
	touch stamps/patch-newlib;
848
892
849
.PHONY: regen-newlib regen-newlib-force
893
.PHONY: regen-newlib regen-newlib-force
850
regen-newlib: stamps/regen-newlib
894
regen-newlib: stamps/regen-newlib
851
regen-newlib-force stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools
895
regen-newlib-force stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools
852
	pushd newlib-$(NEWLIB_VERSION) ; \
896
	pushd newlib-$(NEWLIB_VERSION) ; \
853
	"$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \
897
	"$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \
854
	for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \
898
	for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \
855
	  pushd $$dir ; \
899
	  pushd $$dir ; \
856
	  "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \
900
	  "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \
857
	  "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake"; \
901
	  "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake"; \
858
	  popd ; \
902
	  popd ; \
859
	done; \
903
	done; \
860
	popd;
904
	popd;
861
	[ -d stamps ] || mkdir stamps
905
	[ -d stamps ] || mkdir stamps
862
	touch stamps/regen-newlib;
906
	touch stamps/regen-newlib;
863
907
864
NEWLIB_FLAGS="-ffunction-sections -fdata-sections	\
908
NEWLIB_FLAGS="-ffunction-sections -fdata-sections	\
865
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os	\
909
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os	\
866
-fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128	\
910
-fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128	\
867
-DSMALL_MEMORY"
911
-DSMALL_MEMORY"
868
912
869
.PHONY: build-newlib build-newlib-force
913
.PHONY: build-newlib build-newlib-force
870
build-newlib: stamps/build-newlib
914
build-newlib: stamps/build-newlib
871
build-newlib-force stamps/build-newlib: stamps/regen-newlib stamps/install-binutils stamps/install-gcc
915
build-newlib-force stamps/build-newlib: stamps/regen-newlib stamps/install-binutils stamps/install-gcc
872
	mkdir -p build/newlib && cd build/newlib && \
916
	mkdir -p build/newlib && cd build/newlib && \
873
	pushd ../../newlib-$(NEWLIB_VERSION) ; \
917
	pushd ../../newlib-$(NEWLIB_VERSION) ; \
874
	make clean ; \
918
	make clean ; \
875
	popd ; \
919
	popd ; \
876
	../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX)	\
920
	../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX)	\
877
	--with-build-time-tools=$(PREFIX)				\
921
	--with-build-time-tools=$(PREFIX)				\
878
	--target=$(TARGET) --disable-newlib-supplied-syscalls		\
922
	--target=$(TARGET) --disable-newlib-supplied-syscalls		\
879
	--disable-libgloss --disable-nls --disable-shared		\
923
	--disable-libgloss --disable-nls --disable-shared		\
880
	--enable-newlib-io-long-long --enable-newlib-io-long-double	\
924
	--enable-newlib-io-long-long --enable-newlib-io-long-double	\
881
	--enable-target-optspace --enable-newlib-io-pos-args		\
925
	--enable-target-optspace --enable-newlib-io-pos-args		\
882
	--enable-newlib-reent-small  && \
926
	--enable-newlib-reent-small  && \
883
	$(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \
927
	$(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \
884
	[ -d stamps ] || mkdir stamps
928
	[ -d stamps ] || mkdir stamps
885
	touch stamps/build-newlib;
929
	touch stamps/build-newlib;
886
930
887
.PHONY: install-newlib install-newlib-force
931
.PHONY: install-newlib install-newlib-force
888
install-newlib: stamps/install-newlib
932
install-newlib: stamps/install-newlib
889
install-newlib-force stamps/install-newlib: stamps/build-newlib
933
install-newlib-force stamps/install-newlib: stamps/build-newlib
890
	cd build/newlib && \
934
	cd build/newlib && \
891
	$(MAKE) install
935
	$(MAKE) install
892
	[ -d stamps ] || mkdir stamps
936
	[ -d stamps ] || mkdir stamps
893
	touch stamps/install-newlib;
937
	touch stamps/install-newlib;
894
938
895
.PHONY: clean-newlib
939
.PHONY: clean-newlib
896
clean-newlib:
940
clean-newlib:
897
	rm -rf build/newlib stamps/*-newlib newlib-*
941
	rm -rf build/newlib stamps/*-newlib newlib-*
898
942
899
.PHONY: realclean-newlib
943
.PHONY: realclean-newlib
900
realclean-newlib: clean-newlib
944
realclean-newlib: clean-newlib
901
	rm downloads/$(NEWLIB_ARCHIVE)
945
	rm downloads/$(NEWLIB_ARCHIVE)
902
946
903
947
904
################ BINUTILS ################
948
################ BINUTILS ################
905
949
906
##.PHONY: download-binutils download-binutils-force
950
##.PHONY: download-binutils download-binutils-force
907
##download-binutils: downloads/$(BINUTILS_ARCHIVE)
951
##download-binutils: downloads/$(BINUTILS_ARCHIVE)
908
##download-binutils-force downloads/$(BINUTILS_ARCHIVE):
952
##download-binutils-force downloads/$(BINUTILS_ARCHIVE):
909
##	[ -d downloads ] || mkdir downloads ;
953
##	[ -d downloads ] || mkdir downloads ;
910
##	cd downloads && curl -LO $(BINUTILS_URL)
954
##	cd downloads && curl -LO $(BINUTILS_URL)
911
955
912
##.PHONY: extract-binutils extract-binutils-force
956
##.PHONY: extract-binutils extract-binutils-force
913
##extract-binutils: stamps/extract-binutils
957
##extract-binutils: stamps/extract-binutils
914
##extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
958
##extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
915
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
959
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
916
##	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
960
##	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
917
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
961
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
918
##	tar -jxf $< ;
962
##	tar -jxf $< ;
919
##	[ -d stamps ] || mkdir stamps ;
963
##	[ -d stamps ] || mkdir stamps ;
920
##	touch stamps/extract-binutils;
964
##	touch stamps/extract-binutils;
921
965
922
##.PHONY: patch-binutils patch-binutils-force
966
##.PHONY: patch-binutils patch-binutils-force
923
##patch-binutils: stamps/patch-binutils
967
##patch-binutils: stamps/patch-binutils
924
##patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
968
##patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
925
##	pushd binutils-$(BINUTILS_VERSION) ; \
969
##	pushd binutils-$(BINUTILS_VERSION) ; \
926
##	for f in ../source/avr32/binutils/*.patch; do \
970
##	for f in ../source/avr32/binutils/*.patch; do \
927
##	patch -N -p0 <$${f} ; \
971
##	patch -N -p0 <$${f} ; \
928
##	done ; \
972
##	done ; \
929
##	popd ; \
973
##	popd ; \
930
##	[ -d stamps ] || mkdir stamps
974
##	[ -d stamps ] || mkdir stamps
931
##	touch stamps/patch-binutils;
975
##	touch stamps/patch-binutils;
932
976
933
##.PHONY: regen-binutils regen-binutils-force
977
##.PHONY: regen-binutils regen-binutils-force
934
##regen-binutils: stamps/regen-binutils
978
##regen-binutils: stamps/regen-binutils
935
##regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
979
##regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
936
##	pushd binutils-$(BINUTILS_VERSION) ; \
980
##	pushd binutils-$(BINUTILS_VERSION) ; \
937
##	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
981
##	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
938
##	"$(SUPP_PREFIX)/bin/autoconf" ; \
982
##	"$(SUPP_PREFIX)/bin/autoconf" ; \
939
##	"$(SUPP_PREFIX)/bin/automake" ; \
983
##	"$(SUPP_PREFIX)/bin/automake" ; \
940
##	"$(SUPP_PREFIX)/bin/autoheader" ; \
984
##	"$(SUPP_PREFIX)/bin/autoheader" ; \
941
##	for dir in bfd opcodes binutils gas ld; do \
985
##	for dir in bfd opcodes binutils gas ld; do \
942
##	  pushd $$dir ; \
986
##	  pushd $$dir ; \
943
##	  "$(SUPP_PREFIX)/bin/autoconf"; \
987
##	  "$(SUPP_PREFIX)/bin/autoconf"; \
944
##	  "$(SUPP_PREFIX)/bin/automake"; \
988
##	  "$(SUPP_PREFIX)/bin/automake"; \
945
##	  "$(SUPP_PREFIX)/bin/autoheader"; \
989
##	  "$(SUPP_PREFIX)/bin/autoheader"; \
946
##	  popd ; \
990
##	  popd ; \
947
##	done; \
991
##	done; \
948
##	popd; \
992
##	popd; \
949
##	[ -d stamps ] || mkdir stamps ;
993
##	[ -d stamps ] || mkdir stamps ;
950
##	touch stamps/regen-binutils;
994
##	touch stamps/regen-binutils;
951
995
952
##.PHONY: build-binutils build-binutils-force
996
##.PHONY: build-binutils build-binutils-force
953
##build-binutils: stamps/build-binutils
997
##build-binutils: stamps/build-binutils
954
##build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
998
##build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
955
##	cd binutils-$(BINUTILS_VERSION) ; \
999
##	cd binutils-$(BINUTILS_VERSION) ; \
956
##	./configure   --enable-maintainer-mode		\
1000
##	./configure   --enable-maintainer-mode		\
957
##	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
1001
##	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
958
##	--disable-shared --disable-werror				\
1002
##	--disable-shared --disable-werror				\
959
##	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
1003
##	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
960
##	$(MAKE) all-bfd TARGET-bfd=headers; \
1004
##	$(MAKE) all-bfd TARGET-bfd=headers; \
961
##	rm bfd/Makefile; \
1005
##	rm bfd/Makefile; \
962
##	make configure-bfd; \
1006
##	make configure-bfd; \
963
##	$(MAKE)
1007
##	$(MAKE)
964
##	[ -d stamps ] || mkdir stamps ;
1008
##	[ -d stamps ] || mkdir stamps ;
965
##	touch stamps/build-binutils;
1009
##	touch stamps/build-binutils;
966
1010
967
##.PHONY: install-binutils install-binutils-force
1011
##.PHONY: install-binutils install-binutils-force
968
##install-binutils: stamps/install-binutils
1012
##install-binutils: stamps/install-binutils
969
##install-binutils-force stamps/install-binutils: stamps/build-binutils
1013
##install-binutils-force stamps/install-binutils: stamps/build-binutils
970
##	cd binutils-$(BINUTILS_VERSION) && \
1014
##	cd binutils-$(BINUTILS_VERSION) && \
971
##	$(MAKE) installdirs install-host install-target
1015
##	$(MAKE) installdirs install-host install-target
972
##	[ -d stamps ] || mkdir stamps ;
1016
##	[ -d stamps ] || mkdir stamps ;
973
##	touch stamps/install-binutils;
1017
##	touch stamps/install-binutils;
974
1018
975
1019
976
##.PHONY: clean-binutils
1020
##.PHONY: clean-binutils
977
##clean-binutils:
1021
##clean-binutils:
978
##	rm -rf build/binutils stamps/*-binutils binutils-*
1022
##	rm -rf build/binutils stamps/*-binutils binutils-*
979
1023
980
##.PHONY: realclean-binutils
1024
##.PHONY: realclean-binutils
981
##realclean-binutils: clean-binutils
1025
##realclean-binutils: clean-binutils
982
##	rm downloads/$(BINUTILS_ARCHIVE)
1026
##	rm downloads/$(BINUTILS_ARCHIVE)
983
1027
984
1028
985
########## DFU PROGRAMMER ###########
1029
########## DFU PROGRAMMER ###########
986
1030
987
.PHONY: download-dfu download-dfu-force
1031
.PHONY: download-dfu download-dfu-force
988
download-dfu: downloads/$(DFU_ARCHIVE)
1032
download-dfu: downloads/$(DFU_ARCHIVE)
989
download-dfu-force downloads/$(DFU_ARCHIVE):
1033
download-dfu-force downloads/$(DFU_ARCHIVE):
990
	[ -d downloads ] || mkdir downloads ;
1034
	[ -d downloads ] || mkdir downloads ;
991
	cd downloads && curl -LO $(DFU_URL)
1035
	cd downloads && curl -LO $(DFU_URL)
992
1036
993
.PHONY: extract-dfu extract-dfu-force
1037
.PHONY: extract-dfu extract-dfu-force
994
extract-dfu: stamps/extract-dfu
1038
extract-dfu: stamps/extract-dfu
995
extract-dfu-force stamps/extract-dfu: downloads/$(DFU_ARCHIVE)
1039
extract-dfu-force stamps/extract-dfu: downloads/$(DFU_ARCHIVE)
996
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
1040
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
997
	[ "$$t1" = "$(DFU_MD5)" ] || \
1041
	[ "$$t1" = "$(DFU_MD5)" ] || \
998
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
1042
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
999
	tar -zxf $< ;
1043
	tar -zxf $< ;
1000
	[ -d stamps ] || mkdir stamps ;
1044
	[ -d stamps ] || mkdir stamps ;
1001
	touch stamps/extract-dfu;
1045
	touch stamps/extract-dfu;
1002
1046
1003
.PHONY: build-dfu build-dfu-force
1047
.PHONY: build-dfu build-dfu-force
1004
build-dfu: stamps/build-dfu
1048
build-dfu: stamps/build-dfu
1005
build-dfu-force stamps/build-dfu: stamps/extract-dfu
1049
build-dfu-force stamps/build-dfu: stamps/extract-dfu
1006
	mkdir -p build/dfu-programmer && cd build/dfu-programmer && \
1050
	mkdir -p build/dfu-programmer && cd build/dfu-programmer && \
1007
	../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \
1051
	../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \
1008
	$(MAKE) -j$(PROCS)
1052
	$(MAKE) -j$(PROCS)
1009
	[ -d stamps ] || mkdir stamps
1053
	[ -d stamps ] || mkdir stamps
1010
	touch stamps/build-dfu;
1054
	touch stamps/build-dfu;
1011
1055
1012
.PHONY: install-dfu install-dfu-force
1056
.PHONY: install-dfu install-dfu-force
1013
install-dfu: stamps/install-dfu
1057
install-dfu: stamps/install-dfu
1014
install-dfu-force stamps/install-dfu: stamps/build-dfu
1058
install-dfu-force stamps/install-dfu: stamps/build-dfu
1015
	cd build/dfu-programmer && \
1059
	cd build/dfu-programmer && \
1016
	$(MAKE) install
1060
	$(MAKE) install
1017
	[ -d stamps ] || mkdir stamps
1061
	[ -d stamps ] || mkdir stamps
1018
	touch stamps/install-dfu;
1062
	touch stamps/install-dfu;
1019
1063
1020
.PHONY: clean-dfu
1064
.PHONY: clean-dfu
1021
clean-dfu:
1065
clean-dfu:
1022
	rm -rf build/dfu stamps/*-dfu dfu-*
1066
	rm -rf build/dfu stamps/*-dfu dfu-*
1023
1067
1024
.PHONY: realclean-dfu
1068
.PHONY: realclean-dfu
1025
realclean-dfu: clean-dfu
1069
realclean-dfu: clean-dfu
1026
	rm downloads/$(DFU_ARCHIVE)
1070
	rm downloads/$(DFU_ARCHIVE)
1027
1071
1028
1072
1029
################ Bootstrap GCC ################
1073
################ Bootstrap GCC ################
1030
1074
1031
.PHONY: download-gcc download-gcc-force
1075
.PHONY: download-gcc download-gcc-force
1032
download-gcc: downloads/$(GCC_ARCHIVE)
1076
download-gcc: downloads/$(GCC_ARCHIVE)
1033
download-gcc-force downloads/$(GCC_ARCHIVE):
1077
download-gcc-force downloads/$(GCC_ARCHIVE):
1034
	[ -d downloads ] || mkdir downloads ;
1078
	[ -d downloads ] || mkdir downloads ;
1035
	cd downloads && curl -LO $(GCC_URL)
1079
	cd downloads && curl -LO $(GCC_URL)
1036
1080
1037
.PHONY: extract-gcc extract-gcc-force
1081
.PHONY: extract-gcc extract-gcc-force
1038
extract-gcc: stamps/extract-gcc
1082
extract-gcc: stamps/extract-gcc
1039
extract-gcc-force stamps/extract-gcc: downloads/$(GCC_ARCHIVE)
1083
extract-gcc-force stamps/extract-gcc: downloads/$(GCC_ARCHIVE)
1040
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
1084
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
1041
	[ "$$t1" = "$(GCC_MD5)" ] || \
1085
	[ "$$t1" = "$(GCC_MD5)" ] || \
1042
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
1086
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
1043
	tar -jxf $< ;
1087
	tar -jxf $< ;
1044
	[ -d stamps ] || mkdir stamps ;
1088
	[ -d stamps ] || mkdir stamps ;
1045
	touch stamps/extract-gcc;
1089
	touch stamps/extract-gcc;
1046
1090
1047
.PHONY: patch-gcc patch-gcc-force
1091
.PHONY: patch-gcc patch-gcc-force
1048
patch-gcc: stamps/patch-gcc
1092
patch-gcc: stamps/patch-gcc
1049
patch-gcc-force stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches
1093
patch-gcc-force stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches
1050
	pushd gcc-$(GCC_VERSION) ; \
1094
	pushd gcc-$(GCC_VERSION) ; \
1051
	for f in ../source/avr32/gcc/*.patch; do \
1095
	for f in ../source/avr32/gcc/*.patch; do \
1052
	patch -N -p0 <$${f} ; \
1096
	patch -N -p0 <$${f} ; \
1053
	done ; \
1097
	done ; \
1054
	popd ;
1098
	popd ;
1055
	[ -d stamps ] || mkdir stamps
1099
	[ -d stamps ] || mkdir stamps
1056
	touch stamps/patch-gcc;
1100
	touch stamps/patch-gcc;
1057
1101
1058
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections			\
1102
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections			\
1059
-fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g	\
1103
-fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g	\
1060
-Os -fno-unroll-loops"
1104
-Os -fno-unroll-loops"
1061
1105
1062
.PHONY: build-gcc build-gcc-force
1106
.PHONY: build-gcc build-gcc-force
1063
build-gcc: stamps/build-gcc
1107
build-gcc: stamps/build-gcc
1064
build-gcc-force stamps/build-gcc: stamps/install-binutils stamps/patch-gcc
1108
build-gcc-force stamps/build-gcc: stamps/install-binutils stamps/patch-gcc
1065
	mkdir -p build/gcc && cd build/gcc && \
1109
	mkdir -p build/gcc && cd build/gcc && \
1066
	pushd ../../gcc-$(GCC_VERSION) ; \
1110
	pushd ../../gcc-$(GCC_VERSION) ; \
1067
	make clean ; \
1111
	make clean ; \
1068
	popd ; \
1112
	popd ; \
1069
	../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)"		\
1113
	../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)"		\
1070
	--target=$(TARGET) --enable-languages="c" --with-gnu-ld		\
1114
	--target=$(TARGET) --enable-languages="c" --with-gnu-ld		\
1071
	--with-gnu-as --with-newlib --disable-nls --disable-libssp	\
1115
	--with-gnu-as --with-newlib --disable-nls --disable-libssp	\
1072
	--with-dwarf2 --enable-sjlj-exceptions				\
1116
	--with-dwarf2 --enable-sjlj-exceptions				\
1073
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch	\
1117
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch	\
1074
	--disable-shared						\
1118
	--disable-shared						\
1075
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
1119
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
1076
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET)				\
1120
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET)				\
1077
	--with-sysroot="$(PREFIX)/$(TARGET)"				\
1121
	--with-sysroot="$(PREFIX)/$(TARGET)"				\
1078
	--with-build-sysroot="$(PREFIX)/$(TARGET)"			\
1122
	--with-build-sysroot="$(PREFIX)/$(TARGET)"			\
1079
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
1123
	--with-build-time-tools="$(PREFIX)/$(TARGET)/bin"		\
1080
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)				\
1124
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)				\
1081
	LDFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
1125
	LDFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
1082
	CPPFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
1126
	CPPFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\""		\
1083
	--with-bugurl=$(BUG_URL) \
1127
	--with-bugurl=$(BUG_URL) \
1084
	--with-pkgversion=$(PKG_VERSION) && \
1128
	--with-pkgversion=$(PKG_VERSION) && \
1085
	$(MAKE) -j$(PROCS)
1129
	$(MAKE) -j$(PROCS)
1086
	[ -d stamps ] || mkdir stamps
1130
	[ -d stamps ] || mkdir stamps
1087
	touch stamps/build-gcc;
1131
	touch stamps/build-gcc;
1088
1132
1089
.PHONY: install-gcc install-gcc-force
1133
.PHONY: install-gcc install-gcc-force
1090
install-gcc: stamps/install-gcc
1134
install-gcc: stamps/install-gcc
1091
install-gcc-force stamps/install-gcc: stamps/build-gcc
1135
install-gcc-force stamps/install-gcc: stamps/build-gcc
1092
	cd build/gcc && \
1136
	cd build/gcc && \
1093
	$(MAKE) installdirs install-target && \
1137
	$(MAKE) installdirs install-target && \
1094
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
1138
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
1095
	[ -d stamps ] || mkdir stamps
1139
	[ -d stamps ] || mkdir stamps
1096
	touch stamps/install-gcc;
1140
	touch stamps/install-gcc;
1097
1141
1098
.PHONY: clean-gcc
1142
.PHONY: clean-gcc
1099
clean-gcc:
1143
clean-gcc:
1100
	rm -rf build/gcc stamps/*-gcc gcc-*
1144
	rm -rf build/gcc stamps/*-gcc gcc-*
1101
1145
1102
.PHONY: realclean-gcc
1146
.PHONY: realclean-gcc
1103
realclean-gcc: clean-gcc
1147
realclean-gcc: clean-gcc
1104
	rm downloads/$(GCC_ARCHIVE)
1148
	rm downloads/$(GCC_ARCHIVE)
1105
1149
1106
1150
1107
################ Final GCC ################
1151
################ Final GCC ################
1108
1152
1109
.PHONY: build-final-gcc build-final-gcc-force
1153
.PHONY: build-final-gcc build-final-gcc-force
1110
build-final-gcc: stamps/build-final-gcc
1154
build-final-gcc: stamps/build-final-gcc
1111
build-final-gcc-force stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/patch-gcc
1155
build-final-gcc-force stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/patch-gcc
1112
	mkdir -p build/final-gcc && cd build/final-gcc && \
1156
	mkdir -p build/final-gcc && cd build/final-gcc && \
1113
	pushd ../../gcc-$(GCC_VERSION) ; \
1157
	pushd ../../gcc-$(GCC_VERSION) ; \
1114
	make clean ; \
1158
	make clean ; \
1115
	popd ; \
1159
	popd ; \
1116
	../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \
1160
	../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \
1117
	--target=$(TARGET) $(DEPENDENCIES) --enable-languages="c,c++" --with-gnu-ld \
1161
	--target=$(TARGET) $(DEPENDENCIES) --enable-languages="c,c++" --with-gnu-ld \
1118
	--with-gnu-as --with-newlib --disable-nls --disable-libssp \
1162
	--with-gnu-as --with-newlib --disable-nls --disable-libssp \
1119
	--with-dwarf2 --enable-sjlj-exceptions \
1163
	--with-dwarf2 --enable-sjlj-exceptions \
1120
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch \
1164
	--enable-version-specific-runtime-libs --disable-libstdcxx-pch \
1121
	--disable-shared --enable-__cxa_atexit \
1165
	--disable-shared --enable-__cxa_atexit \
1122
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
1166
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
1123
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET) \
1167
	--enable-cxx-flags=$(CFLAGS_FOR_TARGET) \
1124
	--with-sysroot=$(PREFIX)/$(TARGET) \
1168
	--with-sysroot=$(PREFIX)/$(TARGET) \
1125
	--with-build-sysroot=$(PREFIX)/$(TARGET) \
1169
	--with-build-sysroot=$(PREFIX)/$(TARGET) \
1126
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
1170
	--with-build-time-tools=$(PREFIX)/$(TARGET)/bin \
1127
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \
1171
	CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \
1128
	LDFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
1172
	LDFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
1129
	CPPFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
1173
	CPPFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \
1130
	--with-bugurl=$(BUG_URL) \
1174
	--with-bugurl=$(BUG_URL) \
1131
	--with-pkgversion=$(PKG_VERSION) && \
1175
	--with-pkgversion=$(PKG_VERSION) && \
1132
	$(MAKE) -j$(PROCS)
1176
	$(MAKE) -j$(PROCS)
1133
	[ -d stamps ] || mkdir stamps
1177
	[ -d stamps ] || mkdir stamps
1134
	touch stamps/build-final-gcc;
1178
	touch stamps/build-final-gcc;
1135
1179
1136
.PHONY: install-final-gcc install-final-gcc-force
1180
.PHONY: install-final-gcc install-final-gcc-force
1137
install-final-gcc: stamps/install-final-gcc
1181
install-final-gcc: stamps/install-final-gcc
1138
install-final-gcc-force stamps/install-final-gcc: stamps/build-final-gcc
1182
install-final-gcc-force stamps/install-final-gcc: stamps/build-final-gcc
1139
	cd build/final-gcc && \
1183
	cd build/final-gcc && \
1140
	$(MAKE) installdirs install-target && \
1184
	$(MAKE) installdirs install-target && \
1141
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
1185
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
1142
	[ -d stamps ] || mkdir stamps
1186
	[ -d stamps ] || mkdir stamps
1143
	touch stamps/install-final-gcc;
1187
	touch stamps/install-final-gcc;
1144
1188
1145
.PHONY: clean-final-gcc
1189
.PHONY: clean-final-gcc
1146
clean-final-gcc: clean-gcc
1190
clean-final-gcc: clean-gcc
1147
	rm -rf build/final-gcc stamps/*-final-gcc
1191
	rm -rf build/final-gcc stamps/*-final-gcc
1148
1192
1149
.PHONY: realclean-final-gcc
1193
.PHONY: realclean-final-gcc
1150
realclean-final-gcc: realclean-gcc
1194
realclean-final-gcc: realclean-gcc
1151
1195
1152
1196
1153
########## GDB ###########
1197
########## GDB ###########
1154
1198
1155
.PHONY: download-gdb download-gdb-force
1199
.PHONY: download-gdb download-gdb-force
1156
download-gdb: downloads/$(GDB_ARCHIVE)
1200
download-gdb: downloads/$(GDB_ARCHIVE)
1157
download-gdb-force downloads/$(GDB_ARCHIVE):
1201
download-gdb-force downloads/$(GDB_ARCHIVE):
1158
	[ -d downloads ] || mkdir downloads ;
1202
	[ -d downloads ] || mkdir downloads ;
1159
	cd downloads && curl -LO $(GDB_URL)
1203
	cd downloads && curl -LO $(GDB_URL)
1160
1204
1161
.PHONY: extract-gdb extract-gdb-force
1205
.PHONY: extract-gdb extract-gdb-force
1162
extract-gdb: stamps/extract-gdb
1206
extract-gdb: stamps/extract-gdb
1163
extract-gdb-force stamps/extract-gdb: downloads/$(GDB_ARCHIVE)
1207
extract-gdb-force stamps/extract-gdb: downloads/$(GDB_ARCHIVE)
1164
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
1208
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
1165
	[ "$$t1" = "$(GDB_MD5)" ] || \
1209
	[ "$$t1" = "$(GDB_MD5)" ] || \
1166
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
1210
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
1167
	tar -jxf $< ;
1211
	tar -jxf $< ;
1168
	[ -d stamps ] || mkdir stamps ;
1212
	[ -d stamps ] || mkdir stamps ;
1169
	touch stamps/extract-gdb;
1213
	touch stamps/extract-gdb;
1170
1214
1171
.PHONY: patch-gdb patch-gdb-force
1215
.PHONY: patch-gdb patch-gdb-force
1172
patch-gdb: stamps/patch-gdb
1216
patch-gdb: stamps/patch-gdb
1173
patch-gdb-force stamps/patch-gdb: stamps/extract-gdb stamps/extract-avr32patches
1217
patch-gdb-force stamps/patch-gdb: stamps/extract-gdb stamps/extract-avr32patches
1174
	pushd gdb-$(GDB_VERSION) ; \
1218
	pushd gdb-$(GDB_VERSION) ; \
1175
	for f in ../source/avr32/gdb/*.patch; do \
1219
	for f in ../source/avr32/gdb/*.patch; do \
1176
	patch -N -p0 <$${f} ; \
1220
	patch -N -p0 <$${f} ; \
1177
	done ; \
1221
	done ; \
1178
	popd ; \
1222
	popd ; \
1179
	[ -d stamps ] || mkdir stamps
1223
	[ -d stamps ] || mkdir stamps
1180
	touch stamps/patch-gdb;
1224
	touch stamps/patch-gdb;
1181
1225
1182
.PHONY: regen-gdb regen-gdb-force
1226
.PHONY: regen-gdb regen-gdb-force
1183
regen-gdb: stamps/regen-gdb
1227
regen-gdb: stamps/regen-gdb
1184
regen-gdb-force stamps/regen-gdb: stamps/patch-gdb stamps/install-supp-tools
1228
regen-gdb-force stamps/regen-gdb: stamps/patch-gdb stamps/install-supp-tools
1185
	pushd gdb-$(GDB_VERSION) ; \
1229
	pushd gdb-$(GDB_VERSION) ; \
1186
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
1230
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
1187
	"$(SUPP_PREFIX)/bin/autoconf" ; \
1231
	"$(SUPP_PREFIX)/bin/autoconf" ; \
1188
	"$(SUPP_PREFIX)/bin/automake" ; \
1232
	"$(SUPP_PREFIX)/bin/automake" ; \
1189
	"$(SUPP_PREFIX)/bin/autoheader" ; \
1233
	"$(SUPP_PREFIX)/bin/autoheader" ; \
1190
	for dir in bfd opcodes gdb; do \
1234
	for dir in bfd opcodes gdb; do \
1191
	  pushd $$dir ; \
1235
	  pushd $$dir ; \
1192
	  echo "JESS 1: $$dir" >&2 ; \
1236
	  echo "JESS 1: $$dir" >&2 ; \
1193
	  "$(SUPP_PREFIX)/bin/autoconf"; \
1237
	  "$(SUPP_PREFIX)/bin/autoconf"; \
1194
	  "$(SUPP_PREFIX)/bin/automake"; \
1238
	  "$(SUPP_PREFIX)/bin/automake"; \
1195
	  "$(SUPP_PREFIX)/bin/autoheader"; \
1239
	  "$(SUPP_PREFIX)/bin/autoheader"; \
1196
	  echo "JESS 2: $$dir" >&2 ; \
1240
	  echo "JESS 2: $$dir" >&2 ; \
1197
	  popd ; \
1241
	  popd ; \
1198
	done; \
1242
	done; \
1199
	popd; \
1243
	popd; \
1200
	[ -d stamps ] || mkdir stamps ;
1244
	[ -d stamps ] || mkdir stamps ;
1201
	touch stamps/regen-gdb;
1245
	touch stamps/regen-gdb;
1202
1246
1203
.PHONY: build-gdb build-gdb-force
1247
.PHONY: build-gdb build-gdb-force
1204
build-gdb: stamps/build-gdb
1248
build-gdb: stamps/build-gdb
1205
build-gdb-force stamps/build-gdb: stamps/regen-gdb stamps/install-supp-tools
1249
build-gdb-force stamps/build-gdb: stamps/regen-gdb stamps/install-supp-tools
1206
	echo "JESS 3" >&2 ; \
1250
	echo "JESS 3" >&2 ; \
1207
	mkdir -p build/gdb && cd build/gdb && \
1251
	mkdir -p build/gdb && cd build/gdb && \
1208
	../../gdb-$(GDB_VERSION)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
1252
	../../gdb-$(GDB_VERSION)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
1209
	$(MAKE) -j$(PROCS)
1253
	$(MAKE) -j$(PROCS)
1210
	$(MAKE) installdirs install-host install-target
1254
	$(MAKE) installdirs install-host install-target
1211
	[ -d stamps ] || mkdir stamps
1255
	[ -d stamps ] || mkdir stamps
1212
	touch stamps/build-gdb;
1256
	touch stamps/build-gdb;
1213
1257
1214
.PHONY: install-gdb install-gdb-force
1258
.PHONY: install-gdb install-gdb-force
1215
install-gdb: stamps/install-gdb
1259
install-gdb: stamps/install-gdb
1216
install-gdb-force stamps/install-gdb: stamps/build-gdb
1260
install-gdb-force stamps/install-gdb: stamps/build-gdb
1217
	cd build/gdb && \
1261
	cd build/gdb && \
1218
	$(MAKE) install
1262
	$(MAKE) install
1219
	[ -d stamps ] || mkdir stamps
1263
	[ -d stamps ] || mkdir stamps
1220
	touch stamps/install-gdb;
1264
	touch stamps/install-gdb;
1221
1265
1222
.PHONY: clean-gdb
1266
.PHONY: clean-gdb
1223
clean-gdb:
1267
clean-gdb:
1224
	rm -rf build/gdb stamps/*-gdb gdb-*
1268
	rm -rf build/gdb stamps/*-gdb gdb-*
1225
1269
1226
.PHONY: realclean-gdb
1270
.PHONY: realclean-gdb
1227
realclean-gdb: clean-gdb
1271
realclean-gdb: clean-gdb
1228
	rm downloads/$(GDB_ARCHIVE)
1272
	rm downloads/$(GDB_ARCHIVE)
1229
1273
1230
################ NON-WORKING/NON-ADJUSTED TARGETS ################
1274
################ NON-WORKING/NON-ADJUSTED TARGETS ################
1231
1275
1232
1276
1233
gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/
1277
gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/
1234
	pushd gcc-$(GCC_VERSION)-$(CS_BASE) ; \
1278
	pushd gcc-$(GCC_VERSION)-$(CS_BASE) ; \
1235
	patch -N -p1 < ../patches/gcc-optsize.patch ; \
1279
	patch -N -p1 < ../patches/gcc-optsize.patch ; \
1236
	popd ;
1280
	popd ;
1237
1281
1238
gmp: gmp-$(CS_BASE)/ sudomode
1282
gmp: gmp-$(CS_BASE)/ sudomode
1239
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
1283
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
1240
	pushd ../../gmp-$(CS_BASE) ; \
1284
	pushd ../../gmp-$(CS_BASE) ; \
1241
	make clean ; \
1285
	make clean ; \
1242
	popd ; \
1286
	popd ; \
1243
	sudo -u $(SUDO_USER) ../../gmp-$(CS_BASE)/configure --disable-shared && \
1287
	sudo -u $(SUDO_USER) ../../gmp-$(CS_BASE)/configure --disable-shared && \
1244
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
1288
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
1245
	$(MAKE) install
1289
	$(MAKE) install
1246
1290
1247
mpc: mpc-$(MPC_VERSION)/ sudomode
1291
mpc: mpc-$(MPC_VERSION)/ sudomode
1248
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
1292
	sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \
1249
	pushd ../../mpc-$(MPC_VERSION) ; \
1293
	pushd ../../mpc-$(MPC_VERSION) ; \
1250
	make clean ; \
1294
	make clean ; \
1251
	popd ; \
1295
	popd ; \
1252
	sudo -u $(SUDO_USER) ../../mpc-$(MPC_VERSION)/configure --disable-shared && \
1296
	sudo -u $(SUDO_USER) ../../mpc-$(MPC_VERSION)/configure --disable-shared && \
1253
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
1297
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
1254
	$(MAKE) install
1298
	$(MAKE) install
1255
1299
1256
mpc-$(MPC_VERSION) : $(LOCAL_BASE)/mpc-$(CS_VERSION).tar.bz2
1300
mpc-$(MPC_VERSION) : $(LOCAL_BASE)/mpc-$(CS_VERSION).tar.bz2
1257
ifeq ($(USER),root)
1301
ifeq ($(USER),root)
1258
	sudo -u $(SUDO_USER) tar -jxf $<
1302
	sudo -u $(SUDO_USER) tar -jxf $<
1259
else
1303
else
1260
	tar -jxf $<
1304
	tar -jxf $<
1261
endif
1305
endif
1262
1306
1263
mpfr: gmp mpfr-$(CS_BASE)/ sudomode
1307
mpfr: gmp mpfr-$(CS_BASE)/ sudomode
1264
	sudo -u $(SUDO_USER) mkdir -p build/mpfr && cd build/mpfr && \
1308
	sudo -u $(SUDO_USER) mkdir -p build/mpfr && cd build/mpfr && \
1265
	pushd ../../mpfr-$(CS_BASE) ; \
1309
	pushd ../../mpfr-$(CS_BASE) ; \
1266
	make clean ; \
1310
	make clean ; \
1267
	popd ; \
1311
	popd ; \
1268
	sudo -u $(SUDO_USER) ../../mpfr-$(CS_BASE)/configure LDFLAGS="-Wl,-search_paths_first" --disable-shared && \
1312
	sudo -u $(SUDO_USER) ../../mpfr-$(CS_BASE)/configure LDFLAGS="-Wl,-search_paths_first" --disable-shared && \
1269
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
1313
	sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \
1270
	$(MAKE) install
1314
	$(MAKE) install
1271
1315
1272
cross-gdb: gdb-$(CS_BASE)/
1316
cross-gdb: gdb-$(CS_BASE)/
1273
	mkdir -p build/gdb && cd build/gdb && \
1317
	mkdir -p build/gdb && cd build/gdb && \
1274
	pushd ../../gdb-$(CS_BASE) ; \
1318
	pushd ../../gdb-$(CS_BASE) ; \
1275
	make clean ; \
1319
	make clean ; \
1276
	popd ; \
1320
	popd ; \
1277
	../../gdb-$(CS_BASE)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
1321
	../../gdb-$(CS_BASE)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
1278
	$(MAKE) -j$(PROCS) && \
1322
	$(MAKE) -j$(PROCS) && \
1279
	$(MAKE) installdirs install-host install-target && \
1323
	$(MAKE) installdirs install-host install-target && \
1280
	mkdir -p "$(PREFIX)/man/man1" && \
1324
	mkdir -p "$(PREFIX)/man/man1" && \
1281
	cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1"
1325
	cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1"