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