Rev 11 | Rev 13 | 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 | |||
126 | |||
127 | .PHONY: install-tools |
||
7 | jasmin | 128 | install-tools: install-binutils install-final-gcc install-newlib install-headers |
4 | jasmin | 129 | |
130 | .PHONY: install-cross |
||
131 | install-cross: install-tools install-note |
||
132 | |||
133 | |||
134 | .PHONY: sudomode |
||
135 | sudomode: |
||
136 | ifneq ($(USER),root) |
||
137 | @echo Please run this target with sudo! |
||
138 | @echo e.g.: sudo make targetname |
||
139 | @exit 1 |
||
140 | endif |
||
141 | |||
142 | |||
143 | .PHONY: tst |
||
144 | tst: |
||
9 | jasmin | 145 | @echo "PREFIX=$(PREFIX)" |
146 | @echo "PKG_VERSION=$(PKG_VERSION)" |
||
147 | @echo "BUG_URL=$(BUG_URL)" |
||
4 | jasmin | 148 | |
10 | jasmin | 149 | |
150 | ############ MACROS for the lazy people ;-) ############ |
||
151 | |||
152 | ifeq ($(strip $(MAKEFLAGS)),s) |
||
153 | define quiet_text |
||
154 | @echo "$1" |
||
155 | endef |
||
156 | else |
||
157 | define quiet_text |
||
158 | endef |
||
159 | endif |
||
160 | |||
161 | ## remove a stamp |
||
162 | define rm_stamp |
||
163 | rm -f $(STAMP_DIR)/$(1) |
||
164 | endef |
||
165 | |||
12 | jasmin | 166 | ## remove all stamps |
167 | define rm_stamps |
||
168 | rm -f $(STAMP_DIR)/*-$(1) |
||
169 | endef |
||
170 | |||
10 | jasmin | 171 | ## create the stamp directory if not existing and the stamp |
172 | define make_stamp |
||
173 | @[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR) |
||
174 | date > $(STAMP_DIR)/$(1) |
||
175 | endef |
||
176 | |||
11 | jasmin | 177 | define GET_MY_VARS |
12 | jasmin | 178 | UP_$(1) = $$(shell echo "$(1)" | tr '[a-z]' '[A-Z]') |
179 | MY_VERSION = $$($$(UP_$(1))_VERSION) |
||
180 | MY_ARCHIVE = $$($$(UP_$(1))_ARCHIVE) |
||
181 | MY_URL = $$($$(UP_$(1))_URL) |
||
182 | MY_MD5 = $$($$(UP_$(1))_MD5) |
||
11 | jasmin | 183 | endef |
184 | |||
10 | jasmin | 185 | ## create the download rule and force download rule |
186 | define DOWNLOAD_template |
||
11 | jasmin | 187 | $(call GET_MY_VARS,$(1)) |
12 | jasmin | 188 | $(warning $(1) -> $(MY_URL)) |
189 | $(warning $(1) -> $(MY_URL)) |
||
190 | $(warning $(1) -> $(MY_URL)) |
||
191 | $(warning $(1) -> $(MY_URL)) |
||
192 | $(warning $(1) -> $(MY_URL)) |
||
193 | $(warning $(1) -> $(MY_URL)) |
||
194 | $(warning $(1) -> $(MY_URL)) |
||
195 | $(warning $(1) -> $(MY_URL)) |
||
11 | jasmin | 196 | download-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
197 | download-$(1)-f $(DOWNLOAD_DIR)/$$(MY_ARCHIVE): $(DOWNLOAD_DIR) |
||
198 | cd $(DOWNLOAD_DIR) && curl -LO $$(MY_URL) |
||
12 | jasmin | 199 | |
200 | download-$(1)-remove: |
||
201 | rm -f $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
||
202 | |||
203 | PHONY += download-$(1) download-$(1)-f download-$(1)-remove |
||
10 | jasmin | 204 | endef |
205 | |||
206 | ## extract commands |
||
207 | EXT_BZ2 := tar -jxf |
||
208 | EXT_TGZ := tar -xf |
||
209 | EXT_ZIP := unzip -o |
||
210 | |||
211 | ## create the extract rule and force extract rule |
||
212 | define EXTRACT_template |
||
11 | jasmin | 213 | $(call GET_MY_VARS,$(1)) |
10 | jasmin | 214 | extract-$(1): $(STAMP_DIR)/extract-$(1) |
11 | jasmin | 215 | extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
12 | jasmin | 216 | @(rm -rf $(1)-*; \ |
10 | jasmin | 217 | t1=`openssl md5 $$< | cut -f 2 -d " " -` && \ |
11 | jasmin | 218 | [ "$$$$t1" = "$$(MY_MD5)" ] || \ |
10 | jasmin | 219 | ( echo "Bad Checksum! Please remove the following file and retry: $$<" && false )) |
11 | jasmin | 220 | $(call quiet_text,"Extracting $$(MY_ARCHIVE)") |
10 | jasmin | 221 | $($(2)) $$< |
222 | $(call make_stamp,extract-$(1)) |
||
12 | jasmin | 223 | |
224 | extract-$(1)-remove: |
||
225 | rm -rf $(1)-* |
||
226 | $(call rm_stamp,extract-$(1)) |
||
227 | |||
228 | PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove |
||
10 | jasmin | 229 | endef |
230 | |||
12 | jasmin | 231 | ## create the configure rule and force configure rule |
232 | define CONF_template |
||
233 | $(call GET_MY_VARS,$(1)) |
||
234 | conf-$(1): $(STAMP_DIR)/conf-$(1) |
||
235 | conf-$(1)-f $(STAMP_DIR)/conf-$(1): $(STAMP_DIR)/$(2)-$(1) $(BUILD_DIR)/$(1) |
||
236 | @rm -rf $(BUILD_DIR)/$(1)/* |
||
237 | cd $(BUILD_DIR)/$(1) && \ |
||
238 | ../../$(1)-$$(MY_VERSION)/configure $$($(1)_conf_opts) |
||
239 | $(call make_stamp,conf-$(1)) |
||
240 | |||
241 | conf-$(1)-remove: |
||
242 | $(call rm_stamp,conf-$(1)) |
||
243 | |||
244 | PHONY += conf-$(1) conf-$(1)-f conf-$(1)-remove |
||
245 | endef |
||
246 | |||
247 | ## create the build rule and force build rule |
||
248 | define BUILD_template |
||
249 | $(call GET_MY_VARS,$(1)) |
||
250 | build-$(1): $(STAMP_DIR)/build-$(1) |
||
251 | build-$(1)-f $(STAMP_DIR)/build-$(1): $(STAMP_DIR)/conf-$(1) |
||
252 | cd $(BUILD_DIR)/$(1) && \ |
||
253 | $(MAKE) clean && $(MAKE) -j$(PROCS) |
||
254 | $(call make_stamp,build-$(1)) |
||
255 | |||
256 | build-$(1)-remove: |
||
257 | rm -rf $(BUILD_DIR)/$(1) |
||
258 | $(call rm_stamp,build-$(1)) |
||
259 | |||
260 | PHONY += build-$(1) build-$(1)-f build-$(1)-remove |
||
261 | endef |
||
262 | |||
263 | ## create the install rule and force install rule |
||
264 | define INSTALL_template |
||
265 | install-$(1): $(STAMP_DIR)/install-$(1) |
||
266 | install-$(1)-f $(STAMP_DIR)/install-$(1): $(STAMP_DIR)/build-$(1) |
||
267 | cd $(BUILD_DIR)/$(1) && \ |
||
268 | $(MAKE) install |
||
269 | $(call make_stamp,install-$(1)) |
||
270 | |||
271 | uninstall-$(1): |
||
272 | [ -f $(BUILD_DIR)/$(1)/Makefile ] && \ |
||
273 | cd $(BUILD_DIR)/$(1) && \ |
||
274 | $(MAKE) uninstall || true |
||
275 | $(call rm_stamp,install-$(1)) |
||
276 | |||
277 | PHONY += install-$(1) install-$(1)-f uninstall-$(1) |
||
278 | endef |
||
279 | |||
280 | ## create the clean rule and realclean rule |
||
281 | define CLEAN_template |
||
282 | clean-$(1): uninstall-$(1) extract-$(1)-remove build-$(1)-remove conf-$(1)-remove |
||
283 | |||
284 | realclean-$(1): clean-$(1) download-$(1)-remove |
||
285 | |||
286 | PHONY += clean-$(1) realclean-$(1) |
||
287 | endef |
||
288 | |||
289 | |||
290 | |||
291 | |||
10 | jasmin | 292 | $(DOWNLOAD_DIR): |
293 | mkdir $(DOWNLOAD_DIR) |
||
294 | |||
12 | jasmin | 295 | $(BUILD_DIR)/%: |
296 | mkdir -p $@ |
||
297 | |||
298 | ############# SUPP: AUTOCONF ############ |
||
299 | |||
11 | jasmin | 300 | $(eval $(call DOWNLOAD_template,autoconf)) |
301 | $(eval $(call EXTRACT_template,autoconf,EXT_BZ2)) |
||
12 | jasmin | 302 | autoconf_conf_opts = --prefix="$(SUPP_PREFIX)" |
303 | $(eval $(call CONF_template,autoconf,extract)) |
||
304 | $(eval $(call BUILD_template,autoconf)) |
||
305 | $(eval $(call INSTALL_template,autoconf)) |
||
306 | $(eval $(call CLEAN_template,autoconf)) |
||
10 | jasmin | 307 | |
12 | jasmin | 308 | |
309 | ############ SUPP: AUTOMAKE ############ |
||
310 | |||
311 | $(eval $(call DOWNLOAD_template,automake)) |
||
312 | $(eval $(call EXTRACT_template,automake,EXT_BZ2)) |
||
313 | automake_conf_opts = --prefix="$(SUPP_PREFIX)" |
||
314 | $(eval $(call CONF_template,automake,extract)) |
||
315 | $(eval $(call BUILD_template,automake)) |
||
316 | $(eval $(call INSTALL_template,automake)) |
||
317 | $(eval $(call CLEAN_template,automake)) |
||
318 | |||
319 | |||
10 | jasmin | 320 | .PHONY: $(PHONY) |
321 | |||
322 | |||
323 | .PHONY: tst2 tst3 |
||
324 | tst2: |
||
325 | $(call make_stamp,JES) |
||
326 | tst3: |
||
327 | $(call rm_stamp,JES) |
||
328 | |||
329 | |||
4 | jasmin | 330 | .PHONY: install-note |
331 | install-note: install-tools |
||
332 | @echo |
||
333 | @echo ====== INSTALLATION NOTE ====== |
||
334 | @echo Your tools have now been installed at the following prefix: |
||
335 | @echo $(PREFIX) |
||
336 | @echo |
||
337 | @echo Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc: |
||
338 | @echo export PATH=$(PREFIX)/bin:'$$PATH' |
||
339 | |||
340 | |||
7 | jasmin | 341 | .PHONY: install-supp-tools install-supp-tools-force |
342 | install-supp-tools: stamps/install-supp-tools |
||
343 | install-supp-tools-force stamps/install-supp-tools: stamps/install-autoconf stamps/install-automake |
||
344 | [ -d stamps ] || mkdir stamps ; |
||
345 | touch stamps/install-supp-tools; |
||
4 | jasmin | 346 | |
7 | jasmin | 347 | .PHONY: clean-supp-tools |
348 | clean-supp-tools: clean-autoconf clean-automake |
||
349 | rm stamps/install-supp-tools; |
||
4 | jasmin | 350 | |
7 | jasmin | 351 | .PHONY: realclean-supp-tools |
352 | realclean-supp-tools: realclean-autoconf realclean-automake |
||
353 | rm stamps/install-supp-tools; |
||
4 | jasmin | 354 | |
355 | |||
356 | |||
12 | jasmin | 357 | |
358 | |||
359 | ############ SUPP: AUTOMAKE ############ |
||
360 | |||
361 | ##.PHONY: download-automake download-automake-force |
||
362 | ##download-automake: downloads/$(AUTOMAKE_ARCHIVE) |
||
363 | ##download-automake-force downloads/$(AUTOMAKE_ARCHIVE): |
||
10 | jasmin | 364 | ## [ -d downloads ] || mkdir downloads ; |
12 | jasmin | 365 | ## cd downloads && curl -LO $(AUTOMAKE_URL) |
4 | jasmin | 366 | |
12 | jasmin | 367 | ##.PHONY: extract-automake extract-automake-force |
368 | ##extract-automake: stamps/extract-automake |
||
369 | ##extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE) |
||
10 | jasmin | 370 | ## @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
12 | jasmin | 371 | ## [ "$$t1" = "$(AUTOMAKE_MD5)" ] || \ |
10 | jasmin | 372 | ## ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
373 | ## tar -jxf $< ; |
||
374 | ## [ -d stamps ] || mkdir stamps ; |
||
12 | jasmin | 375 | ## touch stamps/extract-automake; |
4 | jasmin | 376 | |
12 | jasmin | 377 | ##.PHONY: build-automake build-automake-force |
378 | ##build-automake: stamps/build-automake |
||
379 | ##build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf |
||
380 | ## mkdir -p build/automake && cd build/automake && \ |
||
381 | ## ../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \ |
||
382 | ## $(MAKE) -j$(PROCS) |
||
383 | ## [ -d stamps ] || mkdir stamps |
||
384 | ## touch stamps/build-automake; |
||
4 | jasmin | 385 | |
12 | jasmin | 386 | ##.PHONY: install-automake install-automake-force |
387 | ##install-automake: stamps/install-automake |
||
388 | ##install-automake-force stamps/install-automake: stamps/build-automake |
||
389 | ## cd build/automake && \ |
||
390 | ## $(MAKE) install |
||
391 | ## [ -d stamps ] || mkdir stamps |
||
392 | ## touch stamps/install-automake; |
||
4 | jasmin | 393 | |
12 | jasmin | 394 | ##.PHONY: clean-automake |
395 | ##clean-automake: |
||
396 | ## rm -rf build/automake stamps/*-automake automake-* |
||
4 | jasmin | 397 | |
12 | jasmin | 398 | ##.PHONY: realclean-automake |
399 | ##realclean-automake: clean-automake |
||
400 | ## rm downloads/$(AUTOMAKE_ARCHIVE) |
||
4 | jasmin | 401 | |
7 | jasmin | 402 | |
4 | jasmin | 403 | ############# AVR32 PATCHES ############ |
404 | |||
7 | jasmin | 405 | .PHONY: download-avr32patches download-avr32patches-force |
406 | download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE) |
||
407 | download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE): |
||
4 | jasmin | 408 | cd downloads && curl -LO $(AVR32PATCHES_URL) |
409 | |||
7 | jasmin | 410 | .PHONY: extract-avr32patches extract-avr32patches-force |
411 | extract-avr32patches: stamps/extract-avr32patches |
||
412 | extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE) |
||
4 | jasmin | 413 | @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
414 | [ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \ |
||
415 | ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
||
416 | unzip -o $< |
||
417 | [ -d stamps ] || mkdir stamps |
||
418 | touch stamps/extract-avr32patches; |
||
419 | |||
7 | jasmin | 420 | .PHONY: clean-avr32patches |
421 | clean-avr32patches: |
||
422 | rm -rf stamps/*-avr32patches source |
||
4 | jasmin | 423 | |
7 | jasmin | 424 | .PHONY: realclean-avr32patches |
425 | realclean-avr32patches: clean-avr32patches |
||
426 | rm downloads/$(AVR32PATCHES_ARCHIVE) |
||
427 | |||
428 | |||
4 | jasmin | 429 | ############# AVR32 HEADERS ############ |
430 | |||
7 | jasmin | 431 | .PHONY: download-avr32headers download-avr32headers-force |
432 | download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE) |
||
433 | download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE): |
||
4 | jasmin | 434 | cd downloads && curl -LO $(AVR32HEADERS_URL) |
435 | |||
7 | jasmin | 436 | .PHONY: install-headers install-headers-force |
437 | install-headers: stamps/install-headers |
||
438 | install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc |
||
4 | jasmin | 439 | @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
440 | [ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \ |
||
441 | ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
||
442 | unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \ |
||
443 | [ -d stamps ] || mkdir stamps |
||
444 | touch stamps/install-headers; |
||
445 | |||
7 | jasmin | 446 | .PHONY: clean-headers |
447 | clean-headers: |
||
448 | rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32 |
||
4 | jasmin | 449 | |
7 | jasmin | 450 | .PHONY: realclean-headers |
451 | realclean-headers: clean-headers |
||
452 | rm downloads/$(AVR32HEADERS_ARCHIVE) |
||
453 | |||
454 | |||
4 | jasmin | 455 | ################ NEWLIB ################ |
456 | |||
7 | jasmin | 457 | .PHONY: download-newlib download-newlib-force |
458 | download-newlib: downloads/$(NEWLIB_ARCHIVE) |
||
459 | download-newlib-force downloads/$(NEWLIB_ARCHIVE): |
||
4 | jasmin | 460 | [ -d downloads ] || mkdir downloads ; |
461 | cd downloads && curl -LO $(NEWLIB_URL) |
||
462 | |||
7 | jasmin | 463 | .PHONY: extract-newlib extract-newlib-force |
464 | extract-newlib: stamps/extract-newlib |
||
465 | extract-newlib-force stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE) |
||
4 | jasmin | 466 | @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
467 | [ "$$t1" = "$(NEWLIB_MD5)" ] || \ |
||
468 | ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
||
469 | tar -xf $< |
||
470 | [ -d stamps ] || mkdir stamps |
||
471 | touch stamps/extract-newlib; |
||
472 | |||
473 | |||
7 | jasmin | 474 | .PHONY: patch-newlib patch-newlib-force |
475 | patch-newlib: stamps/patch-newlib |
||
476 | patch-newlib-force stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches |
||
4 | jasmin | 477 | pushd newlib-$(NEWLIB_VERSION) ; \ |
478 | for f in ../source/avr32/newlib/*.patch; do \ |
||
479 | patch -N -p0 <$${f} ; \ |
||
480 | done ; \ |
||
481 | popd ; |
||
482 | [ -d stamps ] || mkdir stamps |
||
483 | touch stamps/patch-newlib; |
||
484 | |||
7 | jasmin | 485 | .PHONY: regen-newlib regen-newlib-force |
486 | regen-newlib: stamps/regen-newlib |
||
487 | regen-newlib-force stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools |
||
4 | jasmin | 488 | pushd newlib-$(NEWLIB_VERSION) ; \ |
489 | "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \ |
||
490 | for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \ |
||
491 | pushd $$dir ; \ |
||
492 | "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \ |
||
493 | "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake"; \ |
||
494 | popd ; \ |
||
495 | done; \ |
||
496 | popd; |
||
497 | [ -d stamps ] || mkdir stamps |
||
498 | touch stamps/regen-newlib; |
||
499 | |||
500 | NEWLIB_FLAGS="-ffunction-sections -fdata-sections \ |
||
501 | -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os \ |
||
502 | -fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128 \ |
||
503 | -DSMALL_MEMORY" |
||
504 | |||
7 | jasmin | 505 | .PHONY: build-newlib build-newlib-force |
506 | build-newlib: stamps/build-newlib |
||
507 | build-newlib-force stamps/build-newlib: stamps/regen-newlib stamps/install-binutils stamps/install-gcc |
||
4 | jasmin | 508 | mkdir -p build/newlib && cd build/newlib && \ |
509 | pushd ../../newlib-$(NEWLIB_VERSION) ; \ |
||
510 | make clean ; \ |
||
511 | popd ; \ |
||
512 | ../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX) \ |
||
513 | --with-build-time-tools=$(PREFIX) \ |
||
514 | --target=$(TARGET) --disable-newlib-supplied-syscalls \ |
||
515 | --disable-libgloss --disable-nls --disable-shared \ |
||
516 | --enable-newlib-io-long-long --enable-newlib-io-long-double \ |
||
517 | --enable-target-optspace --enable-newlib-io-pos-args \ |
||
518 | --enable-newlib-reent-small && \ |
||
519 | $(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \ |
||
520 | [ -d stamps ] || mkdir stamps |
||
521 | touch stamps/build-newlib; |
||
522 | |||
7 | jasmin | 523 | .PHONY: install-newlib install-newlib-force |
524 | install-newlib: stamps/install-newlib |
||
525 | install-newlib-force stamps/install-newlib: stamps/build-newlib |
||
4 | jasmin | 526 | cd build/newlib && \ |
527 | $(MAKE) install |
||
528 | [ -d stamps ] || mkdir stamps |
||
529 | touch stamps/install-newlib; |
||
530 | |||
7 | jasmin | 531 | .PHONY: clean-newlib |
532 | clean-newlib: |
||
533 | rm -rf build/newlib stamps/*-newlib newlib-* |
||
534 | |||
535 | .PHONY: realclean-newlib |
||
536 | realclean-newlib: clean-newlib |
||
537 | rm downloads/$(NEWLIB_ARCHIVE) |
||
538 | |||
539 | |||
4 | jasmin | 540 | ################ BINUTILS ################ |
541 | |||
7 | jasmin | 542 | .PHONY: download-binutils download-binutils-force |
543 | download-binutils: downloads/$(BINUTILS_ARCHIVE) |
||
544 | download-binutils-force downloads/$(BINUTILS_ARCHIVE): |
||
4 | jasmin | 545 | [ -d downloads ] || mkdir downloads ; |
546 | cd downloads && curl -LO $(BINUTILS_URL) |
||
547 | |||
7 | jasmin | 548 | .PHONY: extract-binutils extract-binutils-force |
549 | extract-binutils: stamps/extract-binutils |
||
550 | extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE) |
||
4 | jasmin | 551 | @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
552 | [ "$$t1" = "$(BINUTILS_MD5)" ] || \ |
||
553 | ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
||
554 | tar -jxf $< ; |
||
555 | [ -d stamps ] || mkdir stamps ; |
||
556 | touch stamps/extract-binutils; |
||
557 | |||
7 | jasmin | 558 | .PHONY: patch-binutils patch-binutils-force |
559 | patch-binutils: stamps/patch-binutils |
||
560 | patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches |
||
4 | jasmin | 561 | pushd binutils-$(BINUTILS_VERSION) ; \ |
562 | for f in ../source/avr32/binutils/*.patch; do \ |
||
563 | patch -N -p0 <$${f} ; \ |
||
564 | done ; \ |
||
565 | popd ; \ |
||
566 | [ -d stamps ] || mkdir stamps |
||
567 | touch stamps/patch-binutils; |
||
568 | |||
7 | jasmin | 569 | .PHONY: regen-binutils regen-binutils-force |
570 | regen-binutils: stamps/regen-binutils |
||
571 | regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools |
||
4 | jasmin | 572 | pushd binutils-$(BINUTILS_VERSION) ; \ |
573 | "$(SUPP_PREFIX)/bin/aclocal" -I config ; \ |
||
574 | "$(SUPP_PREFIX)/bin/autoconf" ; \ |
||
575 | "$(SUPP_PREFIX)/bin/automake" ; \ |
||
576 | "$(SUPP_PREFIX)/bin/autoheader" ; \ |
||
577 | for dir in bfd opcodes binutils gas ld; do \ |
||
578 | pushd $$dir ; \ |
||
579 | "$(SUPP_PREFIX)/bin/autoconf"; \ |
||
580 | "$(SUPP_PREFIX)/bin/automake"; \ |
||
581 | "$(SUPP_PREFIX)/bin/autoheader"; \ |
||
582 | popd ; \ |
||
583 | done; \ |
||
584 | popd; \ |
||
585 | [ -d stamps ] || mkdir stamps ; |
||
586 | touch stamps/regen-binutils; |
||
587 | |||
7 | jasmin | 588 | .PHONY: build-binutils build-binutils-force |
589 | build-binutils: stamps/build-binutils |
||
590 | build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools |
||
4 | jasmin | 591 | cd binutils-$(BINUTILS_VERSION) ; \ |
592 | ./configure --enable-maintainer-mode \ |
||
593 | --prefix="$(PREFIX)" --target=$(TARGET) --disable-nls \ |
||
594 | --disable-shared --disable-werror \ |
||
595 | --with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) && \ |
||
596 | $(MAKE) all-bfd TARGET-bfd=headers; \ |
||
597 | rm bfd/Makefile; \ |
||
598 | make configure-bfd; \ |
||
599 | $(MAKE) |
||
600 | [ -d stamps ] || mkdir stamps ; |
||
601 | touch stamps/build-binutils; |
||
602 | |||
7 | jasmin | 603 | .PHONY: install-binutils install-binutils-force |
604 | install-binutils: stamps/install-binutils |
||
605 | install-binutils-force stamps/install-binutils: stamps/build-binutils |
||
4 | jasmin | 606 | cd binutils-$(BINUTILS_VERSION) && \ |
607 | $(MAKE) installdirs install-host install-target |
||
608 | [ -d stamps ] || mkdir stamps ; |
||
609 | touch stamps/install-binutils; |
||
610 | |||
7 | jasmin | 611 | |
612 | .PHONY: clean-binutils |
||
613 | clean-binutils: |
||
614 | rm -rf build/binutils stamps/*-binutils binutils-* |
||
615 | |||
616 | .PHONY: realclean-binutils |
||
617 | realclean-binutils: clean-binutils |
||
618 | rm downloads/$(BINUTILS_ARCHIVE) |
||
619 | |||
620 | |||
4 | jasmin | 621 | ########## DFU PROGRAMMER ########### |
622 | |||
7 | jasmin | 623 | .PHONY: download-dfu download-dfu-force |
624 | download-dfu: downloads/$(DFU_ARCHIVE) |
||
625 | download-dfu-force downloads/$(DFU_ARCHIVE): |
||
4 | jasmin | 626 | [ -d downloads ] || mkdir downloads ; |
627 | cd downloads && curl -LO $(DFU_URL) |
||
628 | |||
7 | jasmin | 629 | .PHONY: extract-dfu extract-dfu-force |
630 | extract-dfu: stamps/extract-dfu |
||
631 | extract-dfu-force stamps/extract-dfu: downloads/$(DFU_ARCHIVE) |
||
4 | jasmin | 632 | @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
633 | [ "$$t1" = "$(DFU_MD5)" ] || \ |
||
634 | ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
||
635 | tar -zxf $< ; |
||
636 | [ -d stamps ] || mkdir stamps ; |
||
637 | touch stamps/extract-dfu; |
||
638 | |||
7 | jasmin | 639 | .PHONY: build-dfu build-dfu-force |
640 | build-dfu: stamps/build-dfu |
||
641 | build-dfu-force stamps/build-dfu: stamps/extract-dfu |
||
4 | jasmin | 642 | mkdir -p build/dfu-programmer && cd build/dfu-programmer && \ |
643 | ../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \ |
||
644 | $(MAKE) -j$(PROCS) |
||
645 | [ -d stamps ] || mkdir stamps |
||
646 | touch stamps/build-dfu; |
||
647 | |||
7 | jasmin | 648 | .PHONY: install-dfu install-dfu-force |
649 | install-dfu: stamps/install-dfu |
||
650 | install-dfu-force stamps/install-dfu: stamps/build-dfu |
||
4 | jasmin | 651 | cd build/dfu-programmer && \ |
652 | $(MAKE) install |
||
653 | [ -d stamps ] || mkdir stamps |
||
654 | touch stamps/install-dfu; |
||
655 | |||
7 | jasmin | 656 | .PHONY: clean-dfu |
657 | clean-dfu: |
||
658 | rm -rf build/dfu stamps/*-dfu dfu-* |
||
4 | jasmin | 659 | |
7 | jasmin | 660 | .PHONY: realclean-dfu |
661 | realclean-dfu: clean-dfu |
||
662 | rm downloads/$(DFU_ARCHIVE) |
||
663 | |||
664 | |||
4 | jasmin | 665 | ################ Bootstrap GCC ################ |
666 | |||
7 | jasmin | 667 | .PHONY: download-gcc download-gcc-force |
668 | download-gcc: downloads/$(GCC_ARCHIVE) |
||
669 | download-gcc-force downloads/$(GCC_ARCHIVE): |
||
4 | jasmin | 670 | [ -d downloads ] || mkdir downloads ; |
671 | cd downloads && curl -LO $(GCC_URL) |
||
672 | |||
7 | jasmin | 673 | .PHONY: extract-gcc extract-gcc-force |
674 | extract-gcc: stamps/extract-gcc |
||
675 | extract-gcc-force stamps/extract-gcc: downloads/$(GCC_ARCHIVE) |
||
4 | jasmin | 676 | @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
677 | [ "$$t1" = "$(GCC_MD5)" ] || \ |
||
678 | ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
||
679 | tar -jxf $< ; |
||
680 | [ -d stamps ] || mkdir stamps ; |
||
681 | touch stamps/extract-gcc; |
||
682 | |||
7 | jasmin | 683 | .PHONY: patch-gcc patch-gcc-force |
684 | patch-gcc: stamps/patch-gcc |
||
685 | patch-gcc-force stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches |
||
4 | jasmin | 686 | pushd gcc-$(GCC_VERSION) ; \ |
687 | for f in ../source/avr32/gcc/*.patch; do \ |
||
688 | patch -N -p0 <$${f} ; \ |
||
689 | done ; \ |
||
690 | popd ; |
||
691 | [ -d stamps ] || mkdir stamps |
||
692 | touch stamps/patch-gcc; |
||
693 | |||
694 | CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections \ |
||
695 | -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g \ |
||
696 | -Os -fno-unroll-loops" |
||
697 | |||
7 | jasmin | 698 | .PHONY: build-gcc build-gcc-force |
699 | build-gcc: stamps/build-gcc |
||
700 | build-gcc-force stamps/build-gcc: stamps/install-binutils stamps/patch-gcc |
||
4 | jasmin | 701 | mkdir -p build/gcc && cd build/gcc && \ |
702 | pushd ../../gcc-$(GCC_VERSION) ; \ |
||
703 | make clean ; \ |
||
704 | popd ; \ |
||
705 | ../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)" \ |
||
706 | --target=$(TARGET) --enable-languages="c" --with-gnu-ld \ |
||
707 | --with-gnu-as --with-newlib --disable-nls --disable-libssp \ |
||
708 | --with-dwarf2 --enable-sjlj-exceptions \ |
||
709 | --enable-version-specific-runtime-libs --disable-libstdcxx-pch \ |
||
710 | --disable-shared \ |
||
711 | --with-build-time-tools="$(PREFIX)/$(TARGET)/bin" \ |
||
712 | --enable-cxx-flags=$(CFLAGS_FOR_TARGET) \ |
||
713 | --with-sysroot="$(PREFIX)/$(TARGET)" \ |
||
714 | --with-build-sysroot="$(PREFIX)/$(TARGET)" \ |
||
715 | --with-build-time-tools="$(PREFIX)/$(TARGET)/bin" \ |
||
716 | CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \ |
||
717 | LDFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\"" \ |
||
718 | CPPFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\"" \ |
||
719 | --with-bugurl=$(BUG_URL) \ |
||
720 | --with-pkgversion=$(PKG_VERSION) && \ |
||
721 | $(MAKE) -j$(PROCS) |
||
722 | [ -d stamps ] || mkdir stamps |
||
723 | touch stamps/build-gcc; |
||
724 | |||
7 | jasmin | 725 | .PHONY: install-gcc install-gcc-force |
726 | install-gcc: stamps/install-gcc |
||
727 | install-gcc-force stamps/install-gcc: stamps/build-gcc |
||
4 | jasmin | 728 | cd build/gcc && \ |
729 | $(MAKE) installdirs install-target && \ |
||
730 | $(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man |
||
731 | [ -d stamps ] || mkdir stamps |
||
732 | touch stamps/install-gcc; |
||
733 | |||
7 | jasmin | 734 | .PHONY: clean-gcc |
735 | clean-gcc: |
||
736 | rm -rf build/gcc stamps/*-gcc gcc-* |
||
4 | jasmin | 737 | |
7 | jasmin | 738 | .PHONY: realclean-gcc |
739 | realclean-gcc: clean-gcc |
||
740 | rm downloads/$(GCC_ARCHIVE) |
||
741 | |||
742 | |||
4 | jasmin | 743 | ################ Final GCC ################ |
744 | |||
7 | jasmin | 745 | .PHONY: build-final-gcc build-final-gcc-force |
746 | build-final-gcc: stamps/build-final-gcc |
||
747 | build-final-gcc-force stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/patch-gcc |
||
4 | jasmin | 748 | mkdir -p build/final-gcc && cd build/final-gcc && \ |
749 | pushd ../../gcc-$(GCC_VERSION) ; \ |
||
750 | make clean ; \ |
||
751 | popd ; \ |
||
752 | ../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \ |
||
753 | --target=$(TARGET) $(DEPENDENCIES) --enable-languages="c,c++" --with-gnu-ld \ |
||
754 | --with-gnu-as --with-newlib --disable-nls --disable-libssp \ |
||
755 | --with-dwarf2 --enable-sjlj-exceptions \ |
||
756 | --enable-version-specific-runtime-libs --disable-libstdcxx-pch \ |
||
757 | --disable-shared --enable-__cxa_atexit \ |
||
758 | --with-build-time-tools=$(PREFIX)/$(TARGET)/bin \ |
||
759 | --enable-cxx-flags=$(CFLAGS_FOR_TARGET) \ |
||
760 | --with-sysroot=$(PREFIX)/$(TARGET) \ |
||
761 | --with-build-sysroot=$(PREFIX)/$(TARGET) \ |
||
762 | --with-build-time-tools=$(PREFIX)/$(TARGET)/bin \ |
||
763 | CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \ |
||
764 | LDFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \ |
||
765 | CPPFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \ |
||
766 | --with-bugurl=$(BUG_URL) \ |
||
767 | --with-pkgversion=$(PKG_VERSION) && \ |
||
768 | $(MAKE) -j$(PROCS) |
||
769 | [ -d stamps ] || mkdir stamps |
||
770 | touch stamps/build-final-gcc; |
||
771 | |||
7 | jasmin | 772 | .PHONY: install-final-gcc install-final-gcc-force |
773 | install-final-gcc: stamps/install-final-gcc |
||
774 | install-final-gcc-force stamps/install-final-gcc: stamps/build-final-gcc |
||
4 | jasmin | 775 | cd build/final-gcc && \ |
776 | $(MAKE) installdirs install-target && \ |
||
777 | $(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man |
||
778 | [ -d stamps ] || mkdir stamps |
||
779 | touch stamps/install-final-gcc; |
||
780 | |||
7 | jasmin | 781 | .PHONY: clean-final-gcc |
782 | clean-final-gcc: clean-gcc |
||
783 | rm -rf build/final-gcc stamps/*-final-gcc |
||
4 | jasmin | 784 | |
7 | jasmin | 785 | .PHONY: realclean-final-gcc |
786 | realclean-final-gcc: realclean-gcc |
||
787 | |||
788 | |||
789 | ########## GDB ########### |
||
790 | |||
791 | .PHONY: download-gdb download-gdb-force |
||
792 | download-gdb: downloads/$(GDB_ARCHIVE) |
||
793 | download-gdb-force downloads/$(GDB_ARCHIVE): |
||
794 | [ -d downloads ] || mkdir downloads ; |
||
795 | cd downloads && curl -LO $(GDB_URL) |
||
796 | |||
797 | .PHONY: extract-gdb extract-gdb-force |
||
798 | extract-gdb: stamps/extract-gdb |
||
799 | extract-gdb-force stamps/extract-gdb: downloads/$(GDB_ARCHIVE) |
||
800 | @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
||
801 | [ "$$t1" = "$(GDB_MD5)" ] || \ |
||
802 | ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
||
803 | tar -jxf $< ; |
||
804 | [ -d stamps ] || mkdir stamps ; |
||
805 | touch stamps/extract-gdb; |
||
806 | |||
807 | .PHONY: patch-gdb patch-gdb-force |
||
808 | patch-gdb: stamps/patch-gdb |
||
809 | patch-gdb-force stamps/patch-gdb: stamps/extract-gdb stamps/extract-avr32patches |
||
810 | pushd gdb-$(GDB_VERSION) ; \ |
||
811 | for f in ../source/avr32/gdb/*.patch; do \ |
||
812 | patch -N -p0 <$${f} ; \ |
||
813 | done ; \ |
||
814 | popd ; \ |
||
815 | [ -d stamps ] || mkdir stamps |
||
816 | touch stamps/patch-gdb; |
||
817 | |||
818 | .PHONY: regen-gdb regen-gdb-force |
||
819 | regen-gdb: stamps/regen-gdb |
||
820 | regen-gdb-force stamps/regen-gdb: stamps/patch-gdb stamps/install-supp-tools |
||
821 | pushd gdb-$(GDB_VERSION) ; \ |
||
822 | "$(SUPP_PREFIX)/bin/aclocal" -I config ; \ |
||
823 | "$(SUPP_PREFIX)/bin/autoconf" ; \ |
||
824 | "$(SUPP_PREFIX)/bin/automake" ; \ |
||
825 | "$(SUPP_PREFIX)/bin/autoheader" ; \ |
||
826 | for dir in bfd opcodes gdb; do \ |
||
827 | pushd $$dir ; \ |
||
828 | echo "JESS 1: $$dir" >&2 ; \ |
||
829 | "$(SUPP_PREFIX)/bin/autoconf"; \ |
||
830 | "$(SUPP_PREFIX)/bin/automake"; \ |
||
831 | "$(SUPP_PREFIX)/bin/autoheader"; \ |
||
832 | echo "JESS 2: $$dir" >&2 ; \ |
||
833 | popd ; \ |
||
834 | done; \ |
||
835 | popd; \ |
||
836 | [ -d stamps ] || mkdir stamps ; |
||
837 | touch stamps/regen-gdb; |
||
838 | |||
839 | .PHONY: build-gdb build-gdb-force |
||
840 | build-gdb: stamps/build-gdb |
||
841 | build-gdb-force stamps/build-gdb: stamps/regen-gdb stamps/install-supp-tools |
||
842 | echo "JESS 3" >&2 ; \ |
||
843 | mkdir -p build/gdb && cd build/gdb && \ |
||
844 | ../../gdb-$(GDB_VERSION)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \ |
||
845 | $(MAKE) -j$(PROCS) |
||
846 | $(MAKE) installdirs install-host install-target |
||
847 | [ -d stamps ] || mkdir stamps |
||
848 | touch stamps/build-gdb; |
||
849 | |||
850 | .PHONY: install-gdb install-gdb-force |
||
851 | install-gdb: stamps/install-gdb |
||
852 | install-gdb-force stamps/install-gdb: stamps/build-gdb |
||
853 | cd build/gdb && \ |
||
854 | $(MAKE) install |
||
855 | [ -d stamps ] || mkdir stamps |
||
856 | touch stamps/install-gdb; |
||
857 | |||
858 | .PHONY: clean-gdb |
||
859 | clean-gdb: |
||
860 | rm -rf build/gdb stamps/*-gdb gdb-* |
||
861 | |||
862 | .PHONY: realclean-gdb |
||
863 | realclean-gdb: clean-gdb |
||
864 | rm downloads/$(GDB_ARCHIVE) |
||
865 | |||
4 | jasmin | 866 | ################ NON-WORKING/NON-ADJUSTED TARGETS ################ |
867 | |||
868 | |||
869 | gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/ |
||
870 | pushd gcc-$(GCC_VERSION)-$(CS_BASE) ; \ |
||
871 | patch -N -p1 < ../patches/gcc-optsize.patch ; \ |
||
872 | popd ; |
||
873 | |||
874 | gmp: gmp-$(CS_BASE)/ sudomode |
||
875 | sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \ |
||
876 | pushd ../../gmp-$(CS_BASE) ; \ |
||
877 | make clean ; \ |
||
878 | popd ; \ |
||
879 | sudo -u $(SUDO_USER) ../../gmp-$(CS_BASE)/configure --disable-shared && \ |
||
880 | sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \ |
||
881 | $(MAKE) install |
||
882 | |||
883 | mpc: mpc-$(MPC_VERSION)/ sudomode |
||
884 | sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \ |
||
885 | pushd ../../mpc-$(MPC_VERSION) ; \ |
||
886 | make clean ; \ |
||
887 | popd ; \ |
||
888 | sudo -u $(SUDO_USER) ../../mpc-$(MPC_VERSION)/configure --disable-shared && \ |
||
889 | sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \ |
||
890 | $(MAKE) install |
||
891 | |||
892 | mpc-$(MPC_VERSION) : $(LOCAL_BASE)/mpc-$(CS_VERSION).tar.bz2 |
||
893 | ifeq ($(USER),root) |
||
894 | sudo -u $(SUDO_USER) tar -jxf $< |
||
895 | else |
||
896 | tar -jxf $< |
||
897 | endif |
||
898 | |||
899 | mpfr: gmp mpfr-$(CS_BASE)/ sudomode |
||
900 | sudo -u $(SUDO_USER) mkdir -p build/mpfr && cd build/mpfr && \ |
||
901 | pushd ../../mpfr-$(CS_BASE) ; \ |
||
902 | make clean ; \ |
||
903 | popd ; \ |
||
904 | sudo -u $(SUDO_USER) ../../mpfr-$(CS_BASE)/configure LDFLAGS="-Wl,-search_paths_first" --disable-shared && \ |
||
905 | sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \ |
||
906 | $(MAKE) install |
||
907 | |||
908 | cross-gdb: gdb-$(CS_BASE)/ |
||
909 | mkdir -p build/gdb && cd build/gdb && \ |
||
910 | pushd ../../gdb-$(CS_BASE) ; \ |
||
911 | make clean ; \ |
||
912 | popd ; \ |
||
913 | ../../gdb-$(CS_BASE)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \ |
||
914 | $(MAKE) -j$(PROCS) && \ |
||
915 | $(MAKE) installdirs install-host install-target && \ |
||
916 | mkdir -p "$(PREFIX)/man/man1" && \ |
||
917 | cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1" |
||
918 | |||
919 | .PHONY : clean |
||
920 | clean: |
||
921 | rm -rf build *-$(CS_BASE) binutils-* gcc-* gdb-* newlib-* mpc-* $(LOCAL_BASE) dfu-programmer-* autoconf-* automake-* stamps/* source supp |