source: freewrt/package/rules.mk@ d419478

freewrt_1_0 freewrt_2_0
Last change on this file since d419478 was d419478, checked in by Thorsten Glaser <tg@…>, 19 years ago
  • whitespace cleanup, while here
  • move WRKDIR and DISTFILES definition into PKG_template
  • define WRKDIR via parent BUILD_DIR instead of going up from WRKSRC
  • use a sub-directory as WRKDIR, like BSD
  • rename PKG_BUILD_DIR into WRKBUILD
  • define WRKBUILD relative via WRKDIR
  • rename PKG_INSTALL_DIR into WRKINST
  • fix a few dependencies
  • make use of common cases in the definition of WRKBUILD and WRKINST, removing many redundant lines
  • use WRKDIR instead of BUILD_DIR in places where the latter was used previously
  • while here, remove PKG_CAT stuff

this only affects packages, for now

git-svn-id: svn://www.freewrt.org/trunk/freewrt@303 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
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 if [ "$$(IDEPEND_$(1))" != "" ]; then echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control; fi
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 mkdir -p ${WRKDIR}
53 ${EXTRACT_CMD}
54 if [ -d ./patches ]; then \
55 $(PATCH) $(WRKBUILD) ./patches ; \
56 fi
57 touch $(WRKBUILD)/.prepared
58endif
59
60all: compile
61
62source: ${DISTFILES}
63prepare: source
64 @[ -f $(WRKBUILD)/.prepared ] || { \
65 $(CMD_TRACE) "preparing... "; \
66 $(MAKE) $(WRKBUILD)/.prepared $(MAKE_TRACE); \
67 }
68
69configure: prepare
70 @[ -f $(WRKBUILD)/.configured ] || { \
71 $(CMD_TRACE) "configuring... "; \
72 $(MAKE) $(WRKBUILD)/.configured $(MAKE_TRACE); \
73 }
74
75compile-targets:
76compile: configure
77 @$(CMD_TRACE) "compiling... "
78 @$(MAKE) compile-targets $(MAKE_TRACE)
79
80install-targets:
81install:
82 @$(CMD_TRACE) "installing... "
83 @$(MAKE) install-targets $(MAKE_TRACE)
84
85mostlyclean:
86rebuild:
87 $(CMD_TRACE) "rebuilding... "
88 @-$(MAKE) mostlyclean 2>&1 >/dev/null
89 if [ -f $(WRKBUILD)/.built ]; then \
90 $(MAKE) clean $(MAKE_TRACE); \
91 fi
92 $(MAKE) compile $(MAKE_TRACE)
93
94$(WRKBUILD)/.configured:
95$(WRKBUILD)/.built:
96
97$(PACKAGE_DIR):
98 mkdir -p $@
99
100clean-targets:
101clean:
102 @$(CMD_TRACE) "cleaning... "
103 @$(MAKE) clean-targets $(MAKE_TRACE)
104 rm -rf $(WRKBUILD)
105
106.PHONY: all source prepare compile install clean
Note: See TracBrowser for help on using the repository browser.