Rev 11 | Rev 13 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11 | Rev 12 | ||
---|---|---|---|
Line 68... | Line 68... | ||
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 |
71 | STAMP_DIR := $(CURDIR)/stamps |
72 | DOWNLOAD_DIR := $(CURDIR)/downloads |
72 | DOWNLOAD_DIR := $(CURDIR)/downloads |
- | 73 | BUILD_DIR := $(CURDIR)/build |
|
73 | 74 | ||
74 | ifeq ($(strip $(BUG_URL)),) |
75 | ifeq ($(strip $(BUG_URL)),) |
75 | BUG_URL = https://github.com/jsnyder/avr32-toolchain |
76 | BUG_URL = https://github.com/jsnyder/avr32-toolchain |
76 | endif |
77 | endif |
77 | PKG_VERSION = "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)" |
78 | PKG_VERSION = "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)" |
Line 160... | Line 161... | ||
160 | ## remove a stamp |
161 | ## remove a stamp |
161 | define rm_stamp |
162 | define rm_stamp |
162 | rm -f $(STAMP_DIR)/$(1) |
163 | rm -f $(STAMP_DIR)/$(1) |
163 | endef |
164 | endef |
164 | 165 | ||
- | 166 | ## remove all stamps |
|
- | 167 | define rm_stamps |
|
- | 168 | rm -f $(STAMP_DIR)/*-$(1) |
|
- | 169 | endef |
|
- | 170 | ||
165 | ## create the stamp directory if not existing and the stamp |
171 | ## create the stamp directory if not existing and the stamp |
166 | define make_stamp |
172 | define make_stamp |
167 | @[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR) |
173 | @[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR) |
168 | date > $(STAMP_DIR)/$(1) |
174 | date > $(STAMP_DIR)/$(1) |
169 | endef |
175 | endef |
170 | 176 | ||
171 | define GET_MY_VARS |
177 | define GET_MY_VARS |
172 | UP_$(1):=$$(shell echo "$(1)" | tr '[a-z]' '[A-Z]') |
178 | UP_$(1) = $$(shell echo "$(1)" | tr '[a-z]' '[A-Z]') |
- | 179 | MY_VERSION = $$($$(UP_$(1))_VERSION) |
|
173 | MY_ARCHIVE:=$$($$(UP_$(1))_ARCHIVE) |
180 | MY_ARCHIVE = $$($$(UP_$(1))_ARCHIVE) |
174 | MY_URL:=$$($$(UP_$(1))_URL) |
181 | MY_URL = $$($$(UP_$(1))_URL) |
175 | MY_MD5:=$$($$(UP_$(1))_MD5) |
182 | MY_MD5 = $$($$(UP_$(1))_MD5) |
176 | endef |
183 | endef |
177 | 184 | ||
178 | ## create the download rule and force download rule |
185 | ## create the download rule and force download rule |
179 | define DOWNLOAD_template |
186 | define DOWNLOAD_template |
180 | $(call GET_MY_VARS,$(1)) |
187 | $(call GET_MY_VARS,$(1)) |
- | 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)) |
|
181 | download-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
196 | download-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
182 | download-$(1)-f $(DOWNLOAD_DIR)/$$(MY_ARCHIVE): $(DOWNLOAD_DIR) |
197 | download-$(1)-f $(DOWNLOAD_DIR)/$$(MY_ARCHIVE): $(DOWNLOAD_DIR) |
183 | cd $(DOWNLOAD_DIR) && curl -LO $$(MY_URL) |
198 | cd $(DOWNLOAD_DIR) && curl -LO $$(MY_URL) |
- | 199 | ||
- | 200 | download-$(1)-remove: |
|
- | 201 | rm -f $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
|
- | 202 | ||
184 | PHONY += download-$(1) download-$(1)-f |
203 | PHONY += download-$(1) download-$(1)-f download-$(1)-remove |
185 | endef |
204 | endef |
186 | 205 | ||
187 | ## extract commands |
206 | ## extract commands |
188 | EXT_BZ2 := tar -jxf |
207 | EXT_BZ2 := tar -jxf |
189 | EXT_TGZ := tar -xf |
208 | EXT_TGZ := tar -xf |
Line 192... | Line 211... | ||
192 | ## create the extract rule and force extract rule |
211 | ## create the extract rule and force extract rule |
193 | define EXTRACT_template |
212 | define EXTRACT_template |
194 | $(call GET_MY_VARS,$(1)) |
213 | $(call GET_MY_VARS,$(1)) |
195 | extract-$(1): $(STAMP_DIR)/extract-$(1) |
214 | extract-$(1): $(STAMP_DIR)/extract-$(1) |
196 | extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
215 | extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
197 | @(rm -rf autoconf-*; \ |
216 | @(rm -rf $(1)-*; \ |
198 | t1=`openssl md5 $$< | cut -f 2 -d " " -` && \ |
217 | t1=`openssl md5 $$< | cut -f 2 -d " " -` && \ |
199 | [ "$$$$t1" = "$$(MY_MD5)" ] || \ |
218 | [ "$$$$t1" = "$$(MY_MD5)" ] || \ |
200 | ( echo "Bad Checksum! Please remove the following file and retry: $$<" && false )) |
219 | ( echo "Bad Checksum! Please remove the following file and retry: $$<" && false )) |
201 | $(call quiet_text,"Extracting $$(MY_ARCHIVE)") |
220 | $(call quiet_text,"Extracting $$(MY_ARCHIVE)") |
202 | $($(2)) $$< |
221 | $($(2)) $$< |
203 | $(call make_stamp,extract-$(1)) |
222 | $(call make_stamp,extract-$(1)) |
- | 223 | ||
- | 224 | extract-$(1)-remove: |
|
- | 225 | rm -rf $(1)-* |
|
- | 226 | $(call rm_stamp,extract-$(1)) |
|
- | 227 | ||
204 | PHONY += extract-$(1) extract-$(1)-f |
228 | PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove |
205 | endef |
229 | endef |
206 | 230 | ||
- | 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 | ||
207 | $(DOWNLOAD_DIR): |
292 | $(DOWNLOAD_DIR): |
208 | mkdir $(DOWNLOAD_DIR) |
293 | mkdir $(DOWNLOAD_DIR) |
209 | 294 | ||
- | 295 | $(BUILD_DIR)/%: |
|
- | 296 | mkdir -p $@ |
|
- | 297 | ||
- | 298 | ############# SUPP: AUTOCONF ############ |
|
- | 299 | ||
210 | $(eval $(call DOWNLOAD_template,autoconf)) |
300 | $(eval $(call DOWNLOAD_template,autoconf)) |
211 | $(eval $(call EXTRACT_template,autoconf,EXT_BZ2)) |
301 | $(eval $(call EXTRACT_template,autoconf,EXT_BZ2)) |
- | 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)) |
|
- | 307 | ||
- | 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 | ||
212 | 319 | ||
213 | .PHONY: $(PHONY) |
320 | .PHONY: $(PHONY) |
214 | 321 | ||
215 | 322 | ||
216 | .PHONY: tst2 tst3 |
323 | .PHONY: tst2 tst3 |
Line 244... | Line 351... | ||
244 | .PHONY: realclean-supp-tools |
351 | .PHONY: realclean-supp-tools |
245 | realclean-supp-tools: realclean-autoconf realclean-automake |
352 | realclean-supp-tools: realclean-autoconf realclean-automake |
246 | rm stamps/install-supp-tools; |
353 | rm stamps/install-supp-tools; |
247 | 354 | ||
248 | 355 | ||
249 | ############# SUPP: AUTOCONF ############ |
- | |
250 | 356 | ||
- | 357 | ||
- | 358 | ||
- | 359 | ############ SUPP: AUTOMAKE ############ |
|
- | 360 | ||
251 | ##.PHONY: download-autoconf download-autoconf-force |
361 | ##.PHONY: download-automake download-automake-force |
252 | ##download-autoconf: downloads/$(AUTOCONF_ARCHIVE) |
362 | ##download-automake: downloads/$(AUTOMAKE_ARCHIVE) |
253 | ##download-autoconf-force downloads/$(AUTOCONF_ARCHIVE): |
363 | ##download-automake-force downloads/$(AUTOMAKE_ARCHIVE): |
254 | ## [ -d downloads ] || mkdir downloads ; |
364 | ## [ -d downloads ] || mkdir downloads ; |
255 | ## cd downloads && curl -LO $(AUTOCONF_URL) |
365 | ## cd downloads && curl -LO $(AUTOMAKE_URL) |
256 | 366 | ||
257 | ##.PHONY: extract-autoconf extract-autoconf-force |
367 | ##.PHONY: extract-automake extract-automake-force |
258 | ##extract-autoconf: stamps/extract-autoconf |
368 | ##extract-automake: stamps/extract-automake |
259 | ##extract-autoconf-force stamps/extract-autoconf: downloads/$(AUTOCONF_ARCHIVE) |
369 | ##extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE) |
260 | ## @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
370 | ## @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
261 | ## [ "$$t1" = "$(AUTOCONF_MD5)" ] || \ |
371 | ## [ "$$t1" = "$(AUTOMAKE_MD5)" ] || \ |
262 | ## ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
372 | ## ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
263 | ## tar -jxf $< ; |
373 | ## tar -jxf $< ; |
264 | ## [ -d stamps ] || mkdir stamps ; |
374 | ## [ -d stamps ] || mkdir stamps ; |
265 | ## touch stamps/extract-autoconf; |
- | |
266 | - | ||
267 | .PHONY: build-autoconf build-autoconf-force |
- | |
268 | build-autoconf: stamps/build-autoconf |
- | |
269 | build-autoconf-force stamps/build-autoconf: stamps/extract-autoconf |
- | |
270 | mkdir -p build/autoconf && cd build/autoconf && \ |
- | |
271 | ../../autoconf-$(AUTOCONF_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \ |
- | |
272 | $(MAKE) -j$(PROCS) |
- | |
273 | [ -d stamps ] || mkdir stamps |
- | |
274 | touch stamps/build-autoconf; |
- | |
275 | - | ||
276 | .PHONY: install-autoconf install-autoconf-force |
- | |
277 | install-autoconf: stamps/install-autoconf |
- | |
278 | install-autoconf-force stamps/install-autoconf: stamps/build-autoconf |
- | |
279 | cd build/autoconf && \ |
- | |
280 | $(MAKE) install |
- | |
281 | [ -d stamps ] || mkdir stamps |
- | |
282 | touch stamps/install-autoconf; |
- | |
283 | - | ||
284 | .PHONY: clean-autoconf |
- | |
285 | clean-autoconf: |
- | |
286 | rm -rf build/autoconf stamps/*-autoconf autoconf-* |
- | |
287 | - | ||
288 | .PHONY: realclean-autoconf |
- | |
289 | realclean-autoconf: clean-autoconf |
- | |
290 | rm downloads/$(AUTOCONF_ARCHIVE) |
- | |
291 | - | ||
292 | - | ||
293 | ############ SUPP: AUTOMAKE ############ |
- | |
294 | - | ||
295 | .PHONY: download-automake download-automake-force |
- | |
296 | download-automake: downloads/$(AUTOMAKE_ARCHIVE) |
- | |
297 | download-automake-force downloads/$(AUTOMAKE_ARCHIVE): |
- | |
298 | [ -d downloads ] || mkdir downloads ; |
- | |
299 | cd downloads && curl -LO $(AUTOMAKE_URL) |
- | |
300 | - | ||
301 | .PHONY: extract-automake extract-automake-force |
- | |
302 | extract-automake: stamps/extract-automake |
- | |
303 | extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE) |
- | |
304 | @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ |
- | |
305 | [ "$$t1" = "$(AUTOMAKE_MD5)" ] || \ |
- | |
306 | ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) |
- | |
307 | tar -jxf $< ; |
- | |
308 | [ -d stamps ] || mkdir stamps ; |
- | |
309 | touch stamps/extract-automake; |
375 | ## touch stamps/extract-automake; |
310 | - | ||
311 | .PHONY: build-automake build-automake-force |
- | |
312 | build-automake: stamps/build-automake |
- | |
313 | build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf |
- | |
314 | mkdir -p build/automake && cd build/automake && \ |
- | |
315 | ../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \ |
- | |
316 | $(MAKE) -j$(PROCS) |
- | |
317 | [ -d stamps ] || mkdir stamps |
- | |
318 | touch stamps/build-automake; |
- | |
319 | - | ||
320 | .PHONY: install-automake install-automake-force |
- | |
321 | install-automake: stamps/install-automake |
- | |
322 | install-automake-force stamps/install-automake: stamps/build-automake |
- | |
323 | cd build/automake && \ |
- | |
324 | $(MAKE) install |
- | |
325 | [ -d stamps ] || mkdir stamps |
- | |
326 | touch stamps/install-automake; |
- | |
327 | 376 | ||
- | 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; |
|
- | 385 | ||
- | 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; |
|
- | 393 | ||
328 | .PHONY: clean-automake |
394 | ##.PHONY: clean-automake |
329 | clean-automake: |
395 | ##clean-automake: |
330 | rm -rf build/automake stamps/*-automake automake-* |
396 | ## rm -rf build/automake stamps/*-automake automake-* |
331 | 397 | ||
332 | .PHONY: realclean-automake |
398 | ##.PHONY: realclean-automake |
333 | realclean-automake: clean-automake |
399 | ##realclean-automake: clean-automake |
334 | rm downloads/$(AUTOMAKE_ARCHIVE) |
400 | ## rm downloads/$(AUTOMAKE_ARCHIVE) |
335 | 401 | ||
336 | 402 | ||
337 | ############# AVR32 PATCHES ############ |
403 | ############# AVR32 PATCHES ############ |
338 | 404 | ||
339 | .PHONY: download-avr32patches download-avr32patches-force |
405 | .PHONY: download-avr32patches download-avr32patches-force |