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