source: freewrt/package/rules.mk@ 50d34d3

freewrt_1_0 freewrt_2_0
Last change on this file since 50d34d3 was 50d34d3, checked in by Thorsten Glaser <tg@…>, 19 years ago

remove redundant code, and these mostlyclean/rebuild stuff
(the latter discussed with wbx@ last weekend)

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

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