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