Subversion Repositories avr32-toolchain

Rev

Rev 15 | Rev 19 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15 Rev 17
Line 21... Line 21...
21
# THE SOFTWARE.
21
# THE SOFTWARE.
22
22
23
#### PRIMARY TOOLCHAIN VERSIONS #####
23
#### PRIMARY TOOLCHAIN VERSIONS #####
24
24
25
GCC_VERSION       = 4.4.3
25
GCC_VERSION       = 4.4.3
26
GDB_VERSION_DLOAD = 6.7.1a
-
 
27
GDB_VERSION       = 6.7.1
26
GDB_VERSION       = 6.7.1
-
 
27
GDB_VERSION_DLOAD = $(GDB_VERSION)a
28
BINUTILS_VERSION  = 2.20.1
28
#BINUTILS_VERSION  = 2.20.1
-
 
29
BINUTILS_VERSION  = 2.22
29
NEWLIB_VERSION    = 1.16.0
30
NEWLIB_VERSION    = 1.16.0
30
DFU_VERSION       = 0.5.4
31
DFU_VERSION       = 0.5.4
31
AVR_PATCH_REV	  = 3.2.3.261
32
AVR_PATCH_REV	  = 3.2.3.261
32
AVR_HEADER_REV    = 3.2.3.258
33
AVR_HEADER_REV    = 3.2.3.258
33
34
34
35
35
#### PATHS AND ENVIRONMENT VARIABLES #####
36
#### PATHS AND ENVIRONMENT VARIABLES #####
36
37
37
SHELL       = /bin/bash
38
SHELL       = /bin/bash
38
TARGET      = avr32
39
TARGET      = avr32
-
 
40
# maybe better: avr32-unknown-none
39
41
40
TODAY = $(shell date "+%Y%m%d")
42
TODAY = $(shell date "+%Y%m%d")
41
GIT_REV	    = $(shell git rev-parse --verify HEAD --short 2> /dev/null)
43
GIT_REV	    = $(shell git rev-parse --verify HEAD --short 2> /dev/null)
42
SVN_REV	    = $(shell head -1 ReleaseNotes 2> /dev/null | cut -f 1 -d " ")
44
SVN_REV	    = $(shell head -1 ReleaseNotes 2> /dev/null | cut -f 1 -d " ")
43
45
Line 73... Line 75...
73
BUILD_DIR := $(CURDIR)/build
75
BUILD_DIR := $(CURDIR)/build
74
76
75
ifeq ($(strip $(BUG_URL)),)
77
ifeq ($(strip $(BUG_URL)),)
76
BUG_URL = https://github.com/jsnyder/avr32-toolchain
78
BUG_URL = https://github.com/jsnyder/avr32-toolchain
77
endif
79
endif
78
PKG_VERSION = "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)"
80
#PKG_VERSION = "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)"
-
 
81
PKG_VERSION = "AVR 32 bit GNU Toolchain-$(TOOL_REV)"
79
82
80
83
81
#### PRIMARY TOOLCHAIN URLS #####
84
#### PRIMARY TOOLCHAIN URLS #####
82
85
83
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
86
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
Line 88... Line 91...
88
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
91
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
89
GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214
92
GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214
90
93
91
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
94
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
92
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
95
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
-
 
96
# V 2.20.1
93
BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
97
#BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
-
 
98
# V 2.22
-
 
99
BINUTILS_MD5 = ee0f10756c84979622b992a4a61ea3f5
94
100
95
NEWLIB_ARCHIVE = newlib-$(NEWLIB_VERSION).tar.gz
101
NEWLIB_ARCHIVE = newlib-$(NEWLIB_VERSION).tar.gz
96
NEWLIB_URL = ftp://sources.redhat.com/pub/newlib/$(NEWLIB_ARCHIVE)
102
NEWLIB_URL = ftp://sources.redhat.com/pub/newlib/$(NEWLIB_ARCHIVE)
97
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
103
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
98
104
Line 110... Line 116...
110
DFU_MD5 = 707dcd0f957a74e92456ea6919faa772
116
DFU_MD5 = 707dcd0f957a74e92456ea6919faa772
111
117
112
118
113
##### SUPPORT TOOLS VERSIONS / URLS ######
119
##### SUPPORT TOOLS VERSIONS / URLS ######
114
AUTOCONF_VERSION = 2.64
120
AUTOCONF_VERSION = 2.64
115
AUTOMAKE_VERSION = 1.11
121
#AUTOMAKE_VERSION = 1.11
-
 
122
AUTOMAKE_VERSION = 1.11.1
-
 
123
LIBTOOL_VERSION = 2.2.6b
116
MPC_VERSION = 0.8.1
124
MPC_VERSION = 0.8.1
117
125
118
AUTOCONF_ARCHIVE = autoconf-$(AUTOCONF_VERSION).tar.bz2
126
AUTOCONF_ARCHIVE = autoconf-$(AUTOCONF_VERSION).tar.bz2
119
AUTOCONF_URL = http://mirror.anl.gov/pub/gnu/autoconf/$(AUTOCONF_ARCHIVE)
127
AUTOCONF_URL = http://mirror.anl.gov/pub/gnu/autoconf/$(AUTOCONF_ARCHIVE)
120
AUTOCONF_MD5 = ef400d672005e0be21e0d20648169074
128
AUTOCONF_MD5 = ef400d672005e0be21e0d20648169074
121
129
122
AUTOMAKE_ARCHIVE = automake-$(AUTOMAKE_VERSION).tar.bz2
130
AUTOMAKE_ARCHIVE = automake-$(AUTOMAKE_VERSION).tar.bz2
123
AUTOMAKE_URL = http://mirror.anl.gov/pub/gnu/automake/$(AUTOMAKE_ARCHIVE)
131
AUTOMAKE_URL = http://mirror.anl.gov/pub/gnu/automake/$(AUTOMAKE_ARCHIVE)
-
 
132
# V 1.11
124
AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
133
#AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
-
 
134
# V 1.11.1
-
 
135
AUTOMAKE_MD5 = c2972c4d9b3e29c03d5f2af86249876f
125
136
-
 
137
LIBTOOL_ARCHIVE = libtool-$(LIBTOOL_VERSION).tar.gz
-
 
138
LIBTOOL_URL = http://mirror.anl.gov/pub/gnu/libtool/$(LIBTOOL_ARCHIVE)
-
 
139
LIBTOOL_MD5 = 07da460450490148c6d2df0f21481a25
126
140
127
ALL_TOOLS := gcc gdb binutils newlib avr32patches avr32headers dfu autoconf automake
-
 
128
141
-
 
142
SUPP_TOOLS := autoconf automake libtool
-
 
143
ALL_TOOLS := gcc gdb binutils newlib avr32patches avr32headers dfu $(SUPP_TOOLS)
129
144
130
145
131
.PHONY: install-tools
-
 
132
install-tools: install-binutils install-final-gcc install-newlib install-headers
-
 
133
-
 
134
.PHONY: install-cross
146
all: install-cross
135
install-cross: install-tools install-note
-
 
136
-
 
137
-
 
138
.PHONY: sudomode
-
 
139
sudomode:
-
 
140
ifneq ($(USER),root)
-
 
141
	@echo Please run this target with sudo!
-
 
142
	@echo e.g.: sudo make targetname
-
 
143
	@exit 1
-
 
144
endif
-
 
145
-
 
146
-
 
147
.PHONY: tst
-
 
148
tst:
-
 
149
	@echo "PREFIX=$(PREFIX)"
-
 
150
	@echo "PKG_VERSION=$(PKG_VERSION)"
-
 
151
	@echo "BUG_URL=$(BUG_URL)"
-
 
152
147
153
148
154
############ MACROS for the lazy people ;-) ############
149
############ MACROS for the lazy people ;-) ############
155
150
156
## in silent mode (make -s),, print whats ging on
151
## in silent mode (make -s),, print whats ging on
Line 184... Line 179...
184
	date > $(STAMP_DIR)/$(1)
179
	date > $(STAMP_DIR)/$(1)
185
endef
180
endef
186
181
187
## delete empty directories
182
## delete empty directories
188
define del_empty-directories
183
define del_empty-directories
189
	@find . -type d -empty | xargs rm -rf
184
	@find . -type d -empty -not -path "*.git*" -not -path "*.svn*" -delete
190
endef
185
endef
191
186
192
## delete all empty directories
187
## delete all empty directories
193
## need to do this several times. to remove empty sub directories
188
## need to do this several times. to remove empty sub directories
194
define del_all_empty-directories
189
define del_all_empty-directories
195
	$(call del_empty-directories)
190
	$(call del_empty-directories)
196
	$(call del_empty-directories)
191
	$(call del_empty-directories)
197
	$(call del_empty-directories)
192
	$(call del_empty-directories)
-
 
193
	$(call del_empty-directories)
-
 
194
	$(call del_empty-directories)
198
endef
195
endef
199
196
200
197
201
## to make the following macros more simply, we need the variables
198
## to make the following macros more simply, we need the variables
202
## with the tool name in lowercase. I could have changed the original
199
## with the tool name in lowercase. I could have changed the original
Line 211... Line 208...
211
$(1)_MD5 := $$($$(UP_$(1))_MD5)
208
$(1)_MD5 := $$($$(UP_$(1))_MD5)
212
endef
209
endef
213
210
214
$(foreach tool,$(ALL_TOOLS),$(eval $(call LOWER_TOOL_VARS,$(tool))))
211
$(foreach tool,$(ALL_TOOLS),$(eval $(call LOWER_TOOL_VARS,$(tool))))
215
212
216
-
 
217
## create the download rule and force download rule
213
## create the download rule and force download rule
218
define DOWNLOAD_template
214
define DOWNLOAD_template
219
download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
215
download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
220
download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE):
216
download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE):
221
	[ -d $(DOWNLOAD_DIR) ] || mkdir -p $(DOWNLOAD_DIR)
217
	[ -d $(DOWNLOAD_DIR) ] || mkdir -p $(DOWNLOAD_DIR)
Line 224... Line 220...
224
download-$(1)_TEXT := "Removing $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)"
220
download-$(1)_TEXT := "Removing $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)"
225
download-$(1)-remove:
221
download-$(1)-remove:
226
	$(call quiet_text,$$(download-$(1)_TEXT))
222
	$(call quiet_text,$$(download-$(1)_TEXT))
227
	rm -f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
223
	rm -f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
228
224
-
 
225
available_targets += download-$(1) download-$(1)-f download-$(1)-remove
-
 
226
229
PHONY += download-$(1) download-$(1)-f download-$(1)-remove
227
PHONY += download-$(1) download-$(1)-f download-$(1)-remove
230
endef
228
endef
231
229
232
## extract commands
230
## extract commands
233
EXT_BZ2 := tar -jxf
231
EXT_BZ2 := tar -jxf
Line 236... Line 234...
236
234
237
## create the extract rule and force extract rule
235
## create the extract rule and force extract rule
238
define EXTRACT_template
236
define EXTRACT_template
239
extract-$(1)_TEXT := "Extracting $$($(1)_ARCHIVE)"
237
extract-$(1)_TEXT := "Extracting $$($(1)_ARCHIVE)"
240
238
241
extract-$(1): $(STAMP_DIR)/extract-$(1)
239
extract-$(1): $(call name_stamp,extract-$(1))
242
extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
240
extract-$(1)-f $(call name_stamp,extract-$(1)): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
243
	@(rm -rf $(1)-*; \
241
	@(rm -rf $(1)-*; \
244
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
242
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
245
	[ "$$$$t1" = "$$($(1)_MD5)" ] || \
243
	[ "$$$$t1" = "$$($(1)_MD5)" ] || \
246
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
244
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
247
	$(call quiet_text,$$(extract-$(1)_TEXT))
245
	$(call quiet_text,$$(extract-$(1)_TEXT))
Line 250... Line 248...
250
248
251
extract-$(1)-remove:
249
extract-$(1)-remove:
252
	rm -rf $(1)-*
250
	rm -rf $(1)-*
253
	$(call rm_stamp,extract-$(1))
251
	$(call rm_stamp,extract-$(1))
254
252
-
 
253
clean_extract_$(1)_rule := extract-$(1)-remove
-
 
254
-
 
255
available_targets += extract-$(1) extract-$(1)-f extract-$(1)-remove
-
 
256
255
PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove
257
PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove
256
endef
258
endef
257
259
258
## create the patch rule
260
## create the patch rule
259
define PATCH_template
261
define PATCH_template
260
patch-$(1)_TEXT := "Patching $$($(1)_ARCHIVE)"
262
patch-$(1)_TEXT := "Patching $$($(1)_ARCHIVE)"
261
patch-$(1): $(STAMP_DIR)/patch-$(1)
263
patch-$(1): $(call name_stamp,patch-$(1))
262
$(STAMP_DIR)/patch-$(1): $(STAMP_DIR)/extract-$(1) $(STAMP_DIR)/extract-avr32patches
264
$(call name_stamp,patch-$(1)): $(call name_stamp,extract-$(1)) $(call name_stamp,extract-avr32patches)
263
	$(call quiet_text,$$(patch-$(1)_TEXT))
265
	$(call quiet_text,$$(patch-$(1)_TEXT))
264
	@(pushd $(1)-$$($(1)_VERSION) ; \
266
	@(pushd $(1)-$$($(1)_VERSION) ; \
265
	for f in ../$(install_dir_avr32patches)/$(1)/*.patch; do \
267
	for f in ../$(install_dir_avr32patches)/$(1)/*.patch; do \
266
	patch -N -p0 < $$$${f} ; \
268
	echo "Patching using: $$$${f}" ; \
-
 
269
	patch -N -p0 --no-backup-if-mismatch < $$$${f} ; \
-
 
270
	if [ $$$$? -ne 0 ] ; then exit -1 ; fi ; \
267
	done ; \
271
	done ; \
268
	popd)
272
	popd)
269
	$(call make_stamp,patch-$(1))
273
	$(call make_stamp,patch-$(1))
270
274
271
patch-$(1)-remove: extract-$(1)-remove
275
patch-$(1)-remove: extract-$(1)-remove
272
	$(call rm_stamp,patch-$(1))
276
	$(call rm_stamp,patch-$(1))
273
277
-
 
278
clean_patch_$(1)_rule := patch-$(1)-remove
-
 
279
-
 
280
available_targets += patch-$(1) patch-$(1)-remove
-
 
281
274
PHONY += patch-$(1) patch-$(1)-remove
282
PHONY += patch-$(1) patch-$(1)-remove
275
endef
283
endef
276
284
-
 
285
## one rule for all required support tools
-
 
286
install-supp-tools_targets := $(foreach tool,$(SUPP_TOOLS),$(call name_stamp,install-$(tool)))
-
 
287
install-supp-tools: $(install-supp-tools_targets)
-
 
288
-
 
289
clean-supp-tools: $(foreach tool,$(SUPP_TOOLS),clean-$(tool))
-
 
290
-
 
291
available_targets += install-supp-tools clean-supp-tools
-
 
292
-
 
293
PHONY += install-supp-tools clean-supp-tools
-
 
294
-
 
295
## create the regen rule
-
 
296
## it is used to regenerate the auto tools result files
-
 
297
define REGEN_template
-
 
298
regen-$(1)_TEXT := "Regenerate auto tool files for $$($(1)_ARCHIVE)"
-
 
299
regen-$(1): $(call name_stamp,regen-$(1))
-
 
300
regen-$(1)-f $(call name_stamp,regen-$(1)): $(call name_stamp,$(2)-$(1)) \
-
 
301
                                            $(install-supp-tools_targets)
-
 
302
	$(call quiet_text,$$(regen-$(1)_TEXT))
-
 
303
	@(pushd $(1)-$$($(1)_VERSION) ; \
-
 
304
	PATH=$(SUPP_PREFIX)/bin:$$$${PATH} $(SUPP_PREFIX)/bin/autoreconf -v ; \
-
 
305
	for dir in $$($(1)_regen_dirs) ; do \
-
 
306
	  pushd $$$$dir ; \
-
 
307
	  PATH=$(SUPP_PREFIX)/bin:$$$${PATH} $(SUPP_PREFIX)/bin/autoreconf -v ; \
-
 
308
	  popd ; \
-
 
309
	done; \
-
 
310
	popd)
-
 
311
	$(call make_stamp,regen-$(1))
-
 
312
-
 
313
regen-$(1)-remove:
-
 
314
	$(call rm_stamp,regen-$(1))
-
 
315
-
 
316
clean_regen_$(1)_rule := regen-$(1)-remove
277
317
278
#.PHONY: regen-binutils regen-binutils-force
318
available_targets += regen-$(1) regen-$(1)-f regen-$(1)-remove
279
#regen-binutils: stamps/regen-binutils
-
 
280
#regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
-
 
281
#	pushd binutils-$(BINUTILS_VERSION) ; \
-
 
282
#	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
-
 
283
#	"$(SUPP_PREFIX)/bin/autoconf" ; \
-
 
284
#	"$(SUPP_PREFIX)/bin/automake" ; \
-
 
285
#	"$(SUPP_PREFIX)/bin/autoheader" ; \
-
 
286
#	for dir in bfd opcodes binutils gas ld; do \
-
 
287
#	  pushd $$dir ; \
-
 
288
#	  "$(SUPP_PREFIX)/bin/autoconf"; \
-
 
289
#	  "$(SUPP_PREFIX)/bin/automake"; \
-
 
290
#	  "$(SUPP_PREFIX)/bin/autoheader"; \
-
 
291
#	  popd ; \
-
 
292
#	done; \
-
 
293
#	popd; \
-
 
294
#	[ -d stamps ] || mkdir stamps ;
-
 
295
#	touch stamps/regen-binutils;
-
 
296
319
-
 
320
PHONY += regen-$(1) regen-$(1)-f regen-$(1)-remove
-
 
321
endef
297
322
298
## create the configure rule and force configure rule
323
## create the configure rule and force configure rule
299
define CONF_template
324
define CONF_template
300
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)"
325
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)"
301
conf-$(1): $(STAMP_DIR)/conf-$(1)
326
conf-$(1): $(call name_stamp,conf-$(1))
302
conf-$(1)-f $(STAMP_DIR)/conf-$(1): $(STAMP_DIR)/$(2)-$(1) $(BUILD_DIR)/$(1)
327
conf-$(1)-f $(call name_stamp,conf-$(1)): $(call name_stamp,$(2)-$(1)) $$($(1)_conf_deps)
303
	@rm -rf $(BUILD_DIR)/$(1)/*
328
	@(rm -rf $(BUILD_DIR)/$(1) ; mkdir -p $(BUILD_DIR)/$(1))
304
	$(call quiet_text,$$(conf-$(1)_TEXT))
329
	$(call quiet_text,$$(conf-$(1)_TEXT))
305
	cd $(BUILD_DIR)/$(1) && \
330
	cd $(BUILD_DIR)/$(1) && \
306
	../../$(1)-$$($(1)_VERSION)/configure $$($(1)_conf_opts)
331
	../../$(1)-$$($(1)_VERSION)/configure $$($(1)_conf_opts)
307
	$(call make_stamp,conf-$(1))
332
	$(call make_stamp,conf-$(1))
308
333
309
conf-$(1)-remove:
334
conf-$(1)-remove:
310
	$(call rm_stamp,conf-$(1))
335
	$(call rm_stamp,conf-$(1))
311
336
-
 
337
clean_conf_$(1)_rule := conf-$(1)-remove
-
 
338
-
 
339
available_targets += conf-$(1) conf-$(1)-f conf-$(1)-remove
-
 
340
312
PHONY += conf-$(1) conf-$(1)-f conf-$(1)-remove
341
PHONY += conf-$(1) conf-$(1)-f conf-$(1)-remove
313
endef
342
endef
314
343
315
## create the build rule and force build rule
344
## create the build rule and force build rule
316
define BUILD_template
345
define BUILD_template
317
build-$(1)_TEXT := "Building $(1) $$($(1)_VERSION)"
346
build-$(1)_TEXT := "Building $(1) $$($(1)_VERSION)"
318
build-$(1): $(STAMP_DIR)/build-$(1)
347
build-$(1): $(call name_stamp,build-$(1))
319
build-$(1)-f $(STAMP_DIR)/build-$(1): $(STAMP_DIR)/conf-$(1)
348
build-$(1)-f $(call name_stamp,build-$(1)): $(call name_stamp,conf-$(1))
320
	$(call quiet_text,$$(build-$(1)_TEXT))
349
	$(call quiet_text,$$(build-$(1)_TEXT))
321
	cd $(BUILD_DIR)/$(1) && \
350
	cd $(BUILD_DIR)/$(1) && \
322
	$(MAKE) clean && $(MAKE) -j$(PROCS)
351
	$$($(1)_build_cmds)
323
	$(call make_stamp,build-$(1))
352
	$(call make_stamp,build-$(1))
324
353
325
build-$(1)-remove:
354
build-$(1)-remove:
326
	rm -rf $(BUILD_DIR)/$(1)
355
	rm -rf $(BUILD_DIR)/$(1)
327
	$(call rm_stamp,build-$(1))
356
	$(call rm_stamp,build-$(1))
328
357
-
 
358
clean_build_$(1)_rule := build-$(1)-remove
-
 
359
-
 
360
available_targets += build-$(1) build-$(1)-f build-$(1)-remove
-
 
361
329
PHONY += build-$(1) build-$(1)-f build-$(1)-remove
362
PHONY += build-$(1) build-$(1)-f build-$(1)-remove
330
endef
363
endef
331
364
332
## create the install rule and force install rule
365
## create the install rule and force install rule
333
define INSTALL_template
366
define INSTALL_template
334
install-$(1)_TEXT := "Installing $(1) $$($(1)_VERSION)"
367
install-$(1)_TEXT := "Installing $(1) $$($(1)_VERSION)"
335
install-$(1): $(STAMP_DIR)/install-$(1)
368
install-$(1): $(call name_stamp,install-$(1))
336
install-$(1)-f $(STAMP_DIR)/install-$(1): $(STAMP_DIR)/build-$(1)
369
install-$(1)-f $(call name_stamp,install-$(1)): $(call name_stamp,build-$(1))
337
	$(call quiet_text,$$(install-$(1)_TEXT))
370
	$(call quiet_text,$$(install-$(1)_TEXT))
338
	cd $(BUILD_DIR)/$(1) && \
371
	cd $(BUILD_DIR)/$(1) && \
339
	$(MAKE) install
372
	$(MAKE) install
340
	$(call make_stamp,install-$(1))
373
	$(call make_stamp,install-$(1))
341
374
Line 346... Line 379...
346
	[ -f $(call name_stamp,install-$(1)) ] && \
379
	[ -f $(call name_stamp,install-$(1)) ] && \
347
	cd $(BUILD_DIR)/$(1) && \
380
	cd $(BUILD_DIR)/$(1) && \
348
	$(MAKE) uninstall || true
381
	$(MAKE) uninstall || true
349
	$(call rm_stamp,install-$(1))
382
	$(call rm_stamp,install-$(1))
350
383
-
 
384
clean_uninstall_$(1)_rule := uninstall-$(1)
-
 
385
-
 
386
available_targets += install-$(1) install-$(1)-f uninstall-$(1)
-
 
387
351
PHONY += install-$(1) install-$(1)-f uninstall-$(1)
388
PHONY += install-$(1) install-$(1)-f uninstall-$(1)
352
endef
389
endef
353
390
354
## create the clean rule and realclean rule
391
## create the clean rule and realclean rule
355
define CLEAN_template
392
define CLEAN_template
356
clean-$(1)_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
393
clean-$(1)_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
357
clean-$(1)-text:
394
clean-$(1)-text:
358
	$(call quiet_text,$$(clean-$(1)_TEXT))
395
	$(call quiet_text,$$(clean-$(1)_TEXT))
359
396
360
clean-$(1): clean-$(1)-text uninstall-$(1) extract-$(1)-remove patch-$(1)-remove \
397
clean-$(1): clean-$(1)-text $$(clean_uninstall_$(1)_rule) $$(clean_extract_$(1)_rule) \
-
 
398
            $$(clean_patch_$(1)_rule) $$(clean_regen_$(1)_rule) $$(clean_build_$(1)_rule) \
361
            build-$(1)-remove conf-$(1)-remove
399
            $$(clean_conf_$(1)_rule)
362
	$(call del_all_empty-directories)
400
	$(call del_all_empty-directories)
363
401
-
 
402
clean_rules += clean-$(1)
-
 
403
364
realclean-$(1): clean-$(1) download-$(1)-remove
404
realclean-$(1): clean-$(1) download-$(1)-remove
365
	$(call del_all_empty-directories)
405
	$(call del_all_empty-directories)
366
406
367
PHONY += clean-$(1) realclean-$(1) clean-$(1)-text
-
 
368
endef
-
 
369
-
 
370
## create some dummy rules for the clean rule
407
realclean_rules += realclean-$(1)
371
define DUMMY_patch_remove
-
 
372
patch-$(1)-remove:
-
 
373
PHONY += patch-$(1)-remove
-
 
374
endef
-
 
375
define DUMMY_conf_remove
-
 
376
conf-$(1)-remove:
-
 
377
PHONY += conf-$(1)-remove
-
 
378
endef
-
 
379
define DUMMY_build_remove
-
 
380
build-$(1)-remove:
-
 
381
PHONY += build-$(1)-remove
-
 
382
endef
-
 
383
408
-
 
409
available_targets += clean-$(1) realclean-$(1)
384
410
385
$(BUILD_DIR)/%:
411
PHONY += clean-$(1) realclean-$(1) clean-$(1)-text
386
	mkdir -p $@
412
endef
387
413
388
414
389
############# SUPP: AUTOCONF ############
415
############# SUPP: AUTOCONF ############
390
416
391
$(eval $(call DOWNLOAD_template,autoconf))
417
$(eval $(call DOWNLOAD_template,autoconf))
392
$(eval $(call EXTRACT_template,autoconf,EXT_BZ2))
418
$(eval $(call EXTRACT_template,autoconf,EXT_BZ2))
393
autoconf_conf_opts = --prefix="$(SUPP_PREFIX)"
419
autoconf_conf_opts := --prefix="$(SUPP_PREFIX)"
394
$(eval $(call CONF_template,autoconf,extract))
420
$(eval $(call CONF_template,autoconf,extract))
-
 
421
autoconf_build_cmds :=\
-
 
422
  $(MAKE) clean && $(MAKE) -j$(PROCS)
395
$(eval $(call BUILD_template,autoconf))
423
$(eval $(call BUILD_template,autoconf))
396
$(eval $(call INSTALL_template,autoconf))
424
$(eval $(call INSTALL_template,autoconf))
397
$(eval $(call CLEAN_template,autoconf))
425
$(eval $(call CLEAN_template,autoconf))
398
426
399
427
400
############ SUPP: AUTOMAKE ############
428
############ SUPP: AUTOMAKE ############
401
429
402
$(eval $(call DOWNLOAD_template,automake))
430
$(eval $(call DOWNLOAD_template,automake))
403
$(eval $(call EXTRACT_template,automake,EXT_BZ2))
431
$(eval $(call EXTRACT_template,automake,EXT_BZ2))
404
automake_conf_opts = --prefix="$(SUPP_PREFIX)"
432
automake_conf_opts := --prefix="$(SUPP_PREFIX)"
-
 
433
# automake needs the new autoconf allready installed
-
 
434
automake_conf_deps := $(call name_stamp,install-autoconf)
405
$(eval $(call CONF_template,automake,extract))
435
$(eval $(call CONF_template,automake,extract))
-
 
436
automake_build_cmds := $(autoconf_build_cmds)
406
$(eval $(call BUILD_template,automake))
437
$(eval $(call BUILD_template,automake))
407
$(eval $(call INSTALL_template,automake))
438
$(eval $(call INSTALL_template,automake))
408
$(eval $(call CLEAN_template,automake))
439
$(eval $(call CLEAN_template,automake))
409
440
410
441
-
 
442
############ SUPP: LIBTOOL ############
-
 
443
-
 
444
$(eval $(call DOWNLOAD_template,libtool))
-
 
445
$(eval $(call EXTRACT_template,libtool,EXT_TGZ))
-
 
446
libtool_conf_opts := --prefix="$(SUPP_PREFIX)"
-
 
447
# libtool needs the new autoconf/automake allready installed
-
 
448
libtool_conf_deps := $(call name_stamp,install-autoconf) \
-
 
449
                     $(call name_stamp,install-automake)
-
 
450
$(eval $(call CONF_template,libtool,extract))
-
 
451
libtool_build_cmds := $(autoconf_build_cmds)
-
 
452
$(eval $(call BUILD_template,libtool))
-
 
453
$(eval $(call INSTALL_template,libtool))
-
 
454
$(eval $(call CLEAN_template,libtool))
-
 
455
-
 
456
411
############# AVR32 PATCHES ############
457
############# AVR32 PATCHES ############
412
458
413
$(eval $(call DOWNLOAD_template,avr32patches))
459
$(eval $(call DOWNLOAD_template,avr32patches))
414
$(eval $(call EXTRACT_template,avr32patches,EXT_ZIP))
460
$(eval $(call EXTRACT_template,avr32patches,EXT_ZIP))
415
461
416
## use the uninstall-XXX rule to remove the patches directory
462
## use the uninstall-XXX rule to remove the patches directory
417
PHONY += uninstall-avr32patches
463
PHONY += uninstall-avr32patches
418
uninstall-avr32patches:
464
uninstall-avr32patches:
419
	rm -rf $(install_dir_avr32patches)
465
	rm -rf $(install_dir_avr32patches)
420
466
-
 
467
clean_uninstall_avr32patches_rule = uninstall-avr32patches
-
 
468
421
$(eval $(call CLEAN_template,avr32patches))
469
$(eval $(call CLEAN_template,avr32patches))
422
470
423
471
424
############# AVR32 HEADERS ############
472
############# AVR32 HEADERS ############
425
$(eval $(call DOWNLOAD_template,avr32headers))
473
$(eval $(call DOWNLOAD_template,avr32headers))
426
474
427
###### FIXME: Need to add a dependency to "stamps/install-final-gcc"
475
###### FIXME: Need to add a dependency to "stamps/install-final-gcc"
428
install_path_avr32headers := $(PREFIX)/$(TARGET)/include/
476
install_path_avr32headers := $(PREFIX)/$(TARGET)/include
429
avr32headers_unzip_opt := -d "$(install_path_avr32headers)"
477
avr32headers_unzip_opt := -d "$(install_path_avr32headers)"
430
$(eval $(call EXTRACT_template,avr32headers,EXT_ZIP,$(avr32headers_unzip_opt)))
478
$(eval $(call EXTRACT_template,avr32headers,EXT_ZIP,$(avr32headers_unzip_opt)))
431
479
432
## use the uninstall-XXX rule to remove the patches directory
480
## use the uninstall-XXX rule to remove the patches directory
433
install_dir_avr32headers := $(install_path_avr32headers)/avr32
481
install_dir_avr32headers := $(install_path_avr32headers)/avr32
434
PHONY += uninstall-avr32headers
482
PHONY += uninstall-avr32headers
435
uninstall-avr32headers:
483
uninstall-avr32headers:
436
	rm -rf $(install_dir_avr32headers)
484
	rm -rf $(install_dir_avr32headers)
437
485
-
 
486
clean_uninstall_avr32headers_rule = uninstall-avr32headers
-
 
487
438
$(eval $(call CLEAN_template,avr32headers))
488
$(eval $(call CLEAN_template,avr32headers))
439
489
440
490
441
################ BINUTILS ################
491
################ BINUTILS ################
442
492
443
$(eval $(call DOWNLOAD_template,binutils))
493
$(eval $(call DOWNLOAD_template,binutils))
444
$(eval $(call EXTRACT_template,binutils,EXT_BZ2))
494
$(eval $(call EXTRACT_template,binutils,EXT_BZ2))
445
$(eval $(call PATCH_template,binutils))
495
$(eval $(call PATCH_template,binutils))
-
 
496
binutils_regen_dirs := bfd opcodes binutils gas ld
446
#$(eval $(call REGEN_template,binutils))
497
$(eval $(call REGEN_template,binutils,patch))
-
 
498
#  --enable-maintainer-mode \
-
 
499
447
binutils_conf_opts = \
500
binutils_conf_opts := \
448
--enable-maintainer-mode \
-
 
449
--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls \
501
  --prefix="$(PREFIX)" --target=$(TARGET) --disable-nls \
450
--disable-shared --disable-werror \
502
  --disable-shared --disable-werror \
-
 
503
  --enable-ld=yes --enable-gold=no \
-
 
504
  --with-pkgversion=$(PKG_VERSION) \
451
--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL)
505
  --with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL)
452
$(eval $(call CONF_template,binutils,extract))
506
$(eval $(call CONF_template,binutils,regen))
-
 
507
binutils_build_cmds := \
-
 
508
  $(MAKE) -j$(PROCS)
-
 
509
#   $(MAKE) clean && $(MAKE) -j$(PROCS)
-
 
510
-
 
511
#  $(MAKE) all-bfd TARGET-bfd=headers; \
-
 
512
#  rm bfd/Makefile; \
-
 
513
#  make configure-bfd; \
-
 
514
#  $(MAKE)
-
 
515
453
$(eval $(call BUILD_template,binutils))
516
$(eval $(call BUILD_template,binutils))
454
$(eval $(call INSTALL_template,binutils))
517
$(eval $(call INSTALL_template,binutils))
455
$(eval $(call CLEAN_template,binutils))
518
$(eval $(call CLEAN_template,binutils))
456
519
457
520
458
# we need to satisfy the rules, generated by the CLEAN_template, if they not exist
-
 
459
patch_remove_dummy_tools := autoconf automake avr32patches avr32headers
-
 
460
$(foreach tool,$(patch_remove_dummy_tools),$(eval $(call DUMMY_patch_remove,$(tool))))
-
 
461
conf_remove_dummy_tools := avr32patches avr32headers
-
 
462
$(foreach tool,$(conf_remove_dummy_tools),$(eval $(call DUMMY_conf_remove,$(tool))))
-
 
463
build_remove_dummy_tools := avr32patches avr32headers
-
 
464
$(foreach tool,$(build_remove_dummy_tools),$(eval $(call DUMMY_build_remove,$(tool))))
-
 
465
-
 
466
521
467
.PHONY: $(PHONY)
522
.PHONY: $(PHONY)
468
523
469
524
-
 
525
-
 
526
470
.PHONY: tst2 tst3
527
.PHONY: tst tst2 tst3
-
 
528
tst:
-
 
529
	@echo "PREFIX=$(PREFIX)"
-
 
530
	@echo "PKG_VERSION=$(PKG_VERSION)"
-
 
531
	@echo "BUG_URL=$(BUG_URL)"
471
tst2:
532
tst2:
472
	$(call make_stamp,JES)
533
	$(call make_stamp,JES)
473
tst3:
534
tst3:
474
	$(call rm_stamp,JES)
535
	$(call rm_stamp,JES)
475
536
476
-
 
477
.PHONY: help
537
.PHONY: help
478
help:
538
help:
479
	@echo ""
539
	@echo ""
480
	@echo "The following targets are available:"
540
	@echo "The following targets are available:"
481
	@echo ""
541
	@echo ""
Line 487... Line 547...
487
	@echo "uninstall-XXX	: uninstall the installed package"
547
	@echo "uninstall-XXX	: uninstall the installed package"
488
	@echo "clean-XXX	: clean the package source and build tree"
548
	@echo "clean-XXX	: clean the package source and build tree"
489
	@echo "realclean-XXX	: same as clean-XXX, but remove the downloaded"
549
	@echo "realclean-XXX	: same as clean-XXX, but remove the downloaded"
490
	@echo "		  package, too"
550
	@echo "		  package, too"
491
	@echo ""
551
	@echo ""
492
	@echo "XXX can be one of the following: "
552
	@echo "XXX can be one of the following:"
493
	@echo "$(ALL_TOOLS)"
553
	@echo "$(ALL_TOOLS)"
-
 
554
	@echo "supp-tools"
494
	@echo ""
555
	@echo ""
495
	@echo "The above targets will be executed in the right order and only if"
556
	@echo "The above targets will be executed in the right order and only if"
496
	@echo "they need to be be really built. If you want to rebuild one of then"
557
	@echo "they need to be be really built. If you want to rebuild one of them"
497
	@echo "manualy, you can use the aaaa-XXX-f target (e.g.: build-autoconf-f,"
558
	@echo "manualy, you can use the aaaa-XXX-f target (e.g.: build-autoconf-f,"
498
	@echo "download-automake-f). Please note, that not all steps are available for"
559
	@echo "download-automake-f). Please note, that not all steps are available for"
499
	@echo "all tools (e.g.: install-avr32patches is not available)."
560
	@echo "all tools (e.g.: install-avr32patches is not available)."
500
	@echo ""
561
	@echo ""
-
 
562
	@echo "clean		: clean all; execute all clean-XXX rules"
-
 
563
	@echo "realclean	: same as clean, but remove all downloaded"
-
 
564
	@echo "                  packages, too (execute all realclean-XXX rules)"
501
	@echo ""
565
	@echo ""
-
 
566
	@echo "help		: this inforamtion"
-
 
567
	@echo "helpx		: this inforamtion + available targets"
-
 
568
	@echo ""
-
 
569
-
 
570
define print_target
-
 
571
	@echo "$(1)"
502
572
-
 
573
endef
-
 
574
-
 
575
.PHONY: helpx
-
 
576
helpx: help
-
 
577
	@echo "Available targets:"
-
 
578
	$(foreach target,$(available_targets),$(call print_target,$(target)))
-
 
579
	@echo ""
503
580
504
.PHONY: install-note
581
.PHONY: install-note
505
install-note: install-tools
582
install-note: install-tools
-
 
583
	@echo ""
-
 
584
	@echo "====== INSTALLATION NOTE ======"
-
 
585
	@echo "Your tools have now been installed at the following prefix:"
-
 
586
	@echo "$(PREFIX)"
506
	@echo
587
	@echo
507
	@echo ====== INSTALLATION NOTE ======
-
 
508
	@echo Your tools have now been installed at the following prefix:
588
	@echo "Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:"
509
	@echo $(PREFIX)
589
	@echo '  export PATH="$(PREFIX)/bin:$$PATH"'
510
	@echo
590
	@echo
511
	@echo Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:
-
 
512
	@echo export PATH=$(PREFIX)/bin:'$$PATH'
-
 
513
-
 
514
-
 
515
.PHONY: install-supp-tools install-supp-tools-force
-
 
516
install-supp-tools: stamps/install-supp-tools
-
 
517
install-supp-tools-force stamps/install-supp-tools: stamps/install-autoconf stamps/install-automake
-
 
518
	[ -d stamps ] || mkdir stamps ;
-
 
519
	touch stamps/install-supp-tools;
-
 
520
591
521
.PHONY: clean-supp-tools
592
.PHONY: install-tools
522
clean-supp-tools: clean-autoconf clean-automake
-
 
523
	rm stamps/install-supp-tools;
593
install-tools: install-binutils
524
-
 
525
.PHONY: realclean-supp-tools
594
# FIXME: other currently not finished
526
realclean-supp-tools: realclean-autoconf realclean-automake
595
# install-final-gcc install-newlib install-headers
527
	rm stamps/install-supp-tools;
-
 
528
596
-
 
597
.PHONY: install-cross
-
 
598
install-cross: install-tools install-note
529
599
-
 
600
.PHONY : clean realclean
-
 
601
clean: $(clean_rules)
530
602
-
 
603
realclean: $(realclean_rules)
-
 
604
#	rm -rf build *-$(CS_BASE) binutils-* gcc-* gdb-* newlib-* mpc-* $(LOCAL_BASE) dfu-programmer-* autoconf-* automake-* stamps/* source supp
531
605
532
606
533
############ SUPP: AUTOMAKE ############
607
############ SUPP: AUTOMAKE ############
534
608
535
##.PHONY: download-automake download-automake-force
609
##.PHONY: download-automake download-automake-force
Line 1088... Line 1162...
1088
	$(MAKE) -j$(PROCS) && \
1162
	$(MAKE) -j$(PROCS) && \
1089
	$(MAKE) installdirs install-host install-target && \
1163
	$(MAKE) installdirs install-host install-target && \
1090
	mkdir -p "$(PREFIX)/man/man1" && \
1164
	mkdir -p "$(PREFIX)/man/man1" && \
1091
	cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1"
1165
	cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1"
1092
1166
1093
.PHONY : clean
-
 
1094
clean:
-
 
1095
	rm -rf build *-$(CS_BASE) binutils-* gcc-* gdb-* newlib-* mpc-* $(LOCAL_BASE) dfu-programmer-* autoconf-* automake-* stamps/* source supp
-