source: freewrt/package/rules.mk@ 3438ecb2

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

move some stuff out of that freaking template
I hate templates and GNU make in general

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

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