ramips: create tftp image for the WHR-G300N board
[openwrt.git] / target / sdk / files / package / rules.mk
1 # invoke ipkg with configuration in $(STAGING_DIR)/etc/ipkg.conf
2 IPKG := IPKG_INSTROOT=$(TARGET_DIR) IPKG_CONF_DIR=$(STAGING_DIR)/etc $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
3 IPKG_STATE_DIR := $(TARGET_DIR)/usr/lib/ipkg
4
5 # invoke ipkg-build with some default options
6 IPKG_BUILD := PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
7
8 # where to build (and put) .ipk packages
9 IPKG_TARGET_DIR := $(PACKAGE_DIR)
10
11 ifneq ($(DUMP),)
12 dump:
13 .PHONY: dump
14 endif
15
16 define PKG_template
17 IPKG_$(1):=$(PACKAGE_DIR)/$(2)_$(3)_$(4).ipk
18 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(2)
19 INFO_$(1):=$(IPKG_STATE_DIR)/info/$(2).list
20
21 ifneq ($(BR2_PACKAGE_$(1)),)
22 compile-targets: $$(IPKG_$(1))
23 endif
24 ifneq ($(DEVELOPER)$(SDK),)
25 compile-targets: $$(IPKG_$(1))
26 endif
27 ifeq ($(BR2_PACKAGE_$(1)),y)
28 install-targets: $$(INFO_$(1))
29 endif
30
31 IDEPEND_$(1):=$$(strip $(5))
32
33 $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
34 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(IDIR_$(1)) ./ipkg/$(2).control $(3) $(4)
35 if [ "$$(IDEPEND_$(1))" != "" ]; then echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control; fi
36 for file in conffiles preinst postinst prerm postrm; do \
37 [ -f ./ipkg/$(2).$$$$file ] && cp ./ipkg/$(2).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file || true; \
38 done
39
40 $$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(PKG_BUILD_DIR)/.built $(PACKAGE_DIR)
41
42 $$(INFO_$(1)): $$(IPKG_$(1))
43 $(IPKG) install $$(IPKG_$(1))
44
45 $(2)-clean:
46 rm -f $$(IPKG_$(1))
47 clean-targets: $(2)-clean
48 endef
49
50 ifeq ($(DUMP),)
51 ifneq ($(strip $(PKG_SOURCE)),)
52 $(DL_DIR)/$(PKG_SOURCE):
53 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
54 endif
55
56 ifneq ($(strip $(PKG_CAT)),)
57 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
58 rm -rf $(PKG_BUILD_DIR)
59 mkdir -p $(PKG_BUILD_DIR)
60 $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
61 if [ -d ./patches ]; then \
62 $(PATCH) $(PKG_BUILD_DIR) ./patches ; \
63 fi
64 touch $(PKG_BUILD_DIR)/.prepared
65 endif
66
67 all: compile
68
69 compile-targets:
70 install-targets:
71 clean-targets:
72
73 source: $(DL_DIR)/$(PKG_SOURCE)
74 prepare: $(PKG_BUILD_DIR)/.prepared
75 compile: compile-targets
76 install: install-targets
77 mostlyclean:
78 rebuild:
79 -$(MAKE) mostlyclean
80 if [ -f $(PKG_BUILD_DIR)/.built ]; then \
81 $(MAKE) clean; \
82 fi
83 $(MAKE) compile
84
85 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
86 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
87
88 $(PACKAGE_DIR):
89 mkdir -p $@
90
91 clean: clean-targets
92 rm -rf $(PKG_BUILD_DIR)
93
94 .PHONY: all source prepare compile install clean
95 endif
This page took 0.050612 seconds and 5 git commands to generate.