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