source: freewrt/package/rules.mk@ 428f140

freewrt_1_0 freewrt_2_0
Last change on this file since 428f140 was 65a5cdb, checked in by Thorsten Glaser <tg@…>, 19 years ago

some files don't need our EXTRACT_CMD
empty DISTFILES will do

git-svn-id: svn://www.freewrt.org/trunk/freewrt@259 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 2.5 KB
Line 
1# invoke ipkg with configuration in $(STAGING_DIR)/etc/ipkg.conf
2
3WRKDIR?= ${PKG_BUILD_DIR}/..
4DISTFILES?= ${DL_DIR}/${PKG_SOURCE}
5
6define PKG_template
7IPKG_$(1):=$(PACKAGE_DIR)/$(2)_$(3)_$(4).ipk
8IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(2)
9INFO_$(1):=$(IPKG_STATE_DIR)/info/$(2).list
10
11ifneq ($(BR2_PACKAGE_$(1)),)
12compile-targets: $$(IPKG_$(1))
13endif
14ifneq ($(DEVELOPER),)
15compile-targets: $$(IPKG_$(1))
16endif
17ifeq ($(BR2_PACKAGE_$(1)),y)
18install-targets: $$(INFO_$(1))
19endif
20
21IDEPEND_$(1):=$$(strip $(5))
22
23$$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
24 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(IDIR_$(1)) ./ipkg/$(2).control $(3) $(4)
25 if [ "$$(IDEPEND_$(1))" != "" ]; then echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control; fi
26 for file in conffiles preinst postinst prerm postrm; do \
27 [ -f ./ipkg/$(2).$$$$file ] && cp ./ipkg/$(2).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file || true; \
28 done
29
30$$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(PKG_BUILD_DIR)/.built $(PACKAGE_DIR)
31
32$$(INFO_$(1)): $$(IPKG_$(1))
33 $(IPKG) install $$(IPKG_$(1))
34
35$(2)-clean:
36 rm -f $$(IPKG_$(1))
37clean: $(2)-clean
38endef
39
40
41ifneq ($(strip $(PKG_SOURCE)),)
42$(DL_DIR)/$(PKG_SOURCE):
43 @$(CMD_TRACE) "downloading... "
44 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) $(MAKE_TRACE)
45endif
46
47ifneq (${DISTFILES},)
48$(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
49 rm -rf $(PKG_BUILD_DIR)
50 ${EXTRACT_CMD}
51 if [ -d ./patches ]; then \
52 $(PATCH) $(PKG_BUILD_DIR) ./patches ; \
53 fi
54 touch $(PKG_BUILD_DIR)/.prepared
55endif
56
57all: compile
58
59source: $(DL_DIR)/$(PKG_SOURCE)
60prepare: source
61 @[ -f $(PKG_BUILD_DIR)/.prepared ] || { \
62 $(CMD_TRACE) "preparing... "; \
63 $(MAKE) $(PKG_BUILD_DIR)/.prepared $(MAKE_TRACE); \
64 }
65
66configure: prepare
67 @[ -f $(PKG_BUILD_DIR)/.configured ] || { \
68 $(CMD_TRACE) "configuring... "; \
69 $(MAKE) $(PKG_BUILD_DIR)/.configured $(MAKE_TRACE); \
70 }
71
72compile-targets:
73compile: configure
74 @$(CMD_TRACE) "compiling... "
75 @$(MAKE) compile-targets $(MAKE_TRACE)
76
77install-targets:
78install:
79 @$(CMD_TRACE) "installing... "
80 @$(MAKE) install-targets $(MAKE_TRACE)
81
82mostlyclean:
83rebuild:
84 $(CMD_TRACE) "rebuilding... "
85 @-$(MAKE) mostlyclean 2>&1 >/dev/null
86 if [ -f $(PKG_BUILD_DIR)/.built ]; then \
87 $(MAKE) clean $(MAKE_TRACE); \
88 fi
89 $(MAKE) compile $(MAKE_TRACE)
90
91$(PKG_BUILD_DIR)/.configured:
92$(PKG_BUILD_DIR)/.built:
93
94$(PACKAGE_DIR):
95 mkdir -p $@
96
97clean-targets:
98clean:
99 @$(CMD_TRACE) "cleaning... "
100 @$(MAKE) clean-targets $(MAKE_TRACE)
101 rm -rf $(PKG_BUILD_DIR)
102
103.PHONY: all source prepare compile install clean
Note: See TracBrowser for help on using the repository browser.