build system refactoring in preparation for allowing packages to do host-build steps
[openwrt/svn-archive/archive.git] / tools / firmware-utils / Makefile
1 #
2 # Copyright (C) 2006-2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME := firmware-utils
10
11 include $(INCLUDE_DIR)/host-build.mk
12
13 define cc
14 $(CC) $(HOST_CFLAGS) -include endian.h -o $(HOST_BUILD_DIR)/bin/$(1) src/$(1).c $(2)
15 endef
16
17 define cc2
18 $(CC) $(HOST_CFLAGS) -include endian.h -o $(HOST_BUILD_DIR)/bin/$(firstword $(1)) $(foreach src,$(1),src/$(src).c) $(2)
19 endef
20
21 define Host/Compile
22 mkdir -p $(HOST_BUILD_DIR)/bin
23 $(call cc,addpattern)
24 $(call cc,trx)
25 $(call cc,motorola-bin)
26 $(call cc,dgfirmware)
27 $(call cc,trx2usr)
28 $(call cc,ptgen)
29 $(call cc,airlink)
30 $(call cc,srec2bin)
31 $(call cc,mkmylofw)
32 $(call cc,mkcsysimg)
33 $(call cc,mkzynfw)
34 $(call cc,lzma2eva,-lz)
35 $(call cc,mkcasfw)
36 $(call cc,mkfwimage,-lz)
37 $(call cc,mkfwimage2,-lz)
38 $(call cc,imagetag)
39 $(call cc,add_header)
40 $(call cc,makeamitbin)
41 $(call cc2,mkplanexfw sha1)
42 endef
43
44 define Host/Install
45 $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
46 endef
47
48 $(eval $(call HostBuild))