43bdcc8709125bd5eec8cc3ee0c830295c1857bd
[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=$(IPKG_CONF) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
3 IPKG_STATE_DIR := $(TARGET_DIR)/usr/lib/ipkg
4
5 ifneq ($(DUMP),)
6 dump:
7 .PHONY: dump
8 endif
9
10 define PKG_template
11 IPKG_$(1):=$(PACKAGE_DIR)/$(2)_$(3)_$(4).ipk
12 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(2)
13 INFO_$(1):=$(IPKG_STATE_DIR)/info/$(2).list
14
15 ifneq ($(BR2_PACKAGE_$(1)),)
16 compile-targets: $$(IPKG_$(1))
17 endif
18 ifneq ($(DEVELOPER),)
19 compile-targets: $$(IPKG_$(1))
20 endif
21 ifeq ($(BR2_PACKAGE_$(1)),y)
22 install-targets: $$(INFO_$(1))
23 endif
24
25 IDEPEND_$(1):=$$(strip $(5))
26
27 $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
28 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(IDIR_$(1)) ./ipkg/$(2).control $(3) $(4)
29 if [ "$$(IDEPEND_$(1))" != "" ]; then echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control; fi
30 for file in conffiles preinst postinst prerm postrm; do \
31 [ -f ./ipkg/$(2).$$$$file ] && cp ./ipkg/$(2).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file || true; \
32 done
33
34 $$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(PKG_BUILD_DIR)/.built $(PACKAGE_DIR)
35
36 $$(INFO_$(1)): $$(IPKG_$(1))
37 $(IPKG) install $$(IPKG_$(1))
38
39 $(2)-clean:
40 rm -f $$(IPKG_$(1))
41 clean-targets: $(2)-clean
42 endef
43
44 ifeq ($(DUMP),)
45 ifneq ($(strip $(PKG_SOURCE)),)
46 $(DL_DIR)/$(PKG_SOURCE):
47 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
48 endif
49
50 ifneq ($(strip $(PKG_CAT)),)
51 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
52 rm -rf $(PKG_BUILD_DIR)
53 mkdir -p $(PKG_BUILD_DIR)
54 $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
55 if [ -d ./patches ]; then \
56 $(PATCH) $(PKG_BUILD_DIR) ./patches ; \
57 fi
58 touch $(PKG_BUILD_DIR)/.prepared
59 endif
60
61 all: compile
62
63 compile-targets:
64 install-targets:
65 clean-targets:
66
67 source: $(DL_DIR)/$(PKG_SOURCE)
68 prepare: $(PKG_BUILD_DIR)/.prepared
69 compile: compile-targets
70 install: install-targets
71 mostlyclean:
72 rebuild:
73 -$(MAKE) mostlyclean
74 if [ -f $(PKG_BUILD_DIR)/.built ]; then \
75 $(MAKE) clean; \
76 fi
77 $(MAKE) compile
78
79 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
80 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
81
82 $(PACKAGE_DIR):
83 mkdir -p $@
84
85 clean: clean-targets
86 rm -rf $(PKG_BUILD_DIR)
87
88 .PHONY: all source prepare compile install clean
89 endif
This page took 0.042814 seconds and 3 git commands to generate.