| 1 | # $FreeWRT$
|
|---|
| 2 |
|
|---|
| 3 | WRKDIR_BASE:= ${BUILD_DIR}
|
|---|
| 4 |
|
|---|
| 5 | include ${TOPDIR}/package/buildhlp.mk
|
|---|
| 6 |
|
|---|
| 7 | define PKG_template
|
|---|
| 8 | IPKG_$(1)= $(PACKAGE_DIR)/$(2)_$(3)_$(4).ipk
|
|---|
| 9 | IDIR_$(1)= $(WRKDIR)/ipkg/$(2)
|
|---|
| 10 | INFO_$(1)= $(IPKG_STATE_DIR)/info/$(2).list
|
|---|
| 11 |
|
|---|
| 12 | ifneq ($(FWRT_PACKAGE_$(1)),)
|
|---|
| 13 | compile-targets: $$(IPKG_$(1))
|
|---|
| 14 | endif
|
|---|
| 15 | ifneq ($(DEVELOPER),)
|
|---|
| 16 | compile-targets: $$(IPKG_$(1))
|
|---|
| 17 | endif
|
|---|
| 18 | ifeq ($(FWRT_PACKAGE_$(1)),y)
|
|---|
| 19 | install-targets: $$(INFO_$(1))
|
|---|
| 20 | endif
|
|---|
| 21 |
|
|---|
| 22 | IDEPEND_$(1):= $$(strip $(5))
|
|---|
| 23 |
|
|---|
| 24 | $$(IDIR_$(1))/CONTROL/control: $(WRKBUILD)/.prepared
|
|---|
| 25 | $(SCRIPT_DIR)/make-ipkg-dir.sh $$(IDIR_$(1)) ./ipkg/$(2).control $(3) $(4)
|
|---|
| 26 | [ -z "$$(IDEPEND_$(1))" ] || echo "Depends: $$(IDEPEND_$(1))" >>$$(IDIR_$(1))/CONTROL/control
|
|---|
| 27 | for file in conffiles preinst postinst prerm postrm; do \
|
|---|
| 28 | [ ! -f ./ipkg/$(2).$$$$file ] || cp ./ipkg/$(2).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file; \
|
|---|
| 29 | done
|
|---|
| 30 |
|
|---|
| 31 | $$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(WRKBUILD)/.built $(PACKAGE_DIR)
|
|---|
| 32 |
|
|---|
| 33 | $$(INFO_$(1)): $$(IPKG_$(1))
|
|---|
| 34 | $(IPKG) install $$(IPKG_$(1))
|
|---|
| 35 |
|
|---|
| 36 | $(2)-clean:
|
|---|
| 37 | rm -f $$(IPKG_$(1))
|
|---|
| 38 | clean: $(2)-clean
|
|---|
| 39 | endef
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 | all: compile
|
|---|
| 43 |
|
|---|
| 44 | source: ${DISTFILES}
|
|---|
| 45 | prepare: source
|
|---|
| 46 | @[ -f $(WRKBUILD)/.prepared ] || { \
|
|---|
| 47 | $(CMD_TRACE) "preparing... "; \
|
|---|
| 48 | $(MAKE) $(WRKBUILD)/.prepared $(MAKE_TRACE); \
|
|---|
| 49 | }
|
|---|
| 50 |
|
|---|
| 51 | configure: prepare
|
|---|
| 52 | @[ -f $(WRKBUILD)/.configured ] || { \
|
|---|
| 53 | $(CMD_TRACE) "configuring... "; \
|
|---|
| 54 | $(MAKE) $(WRKBUILD)/.configured $(MAKE_TRACE); \
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | compile-targets:
|
|---|
| 58 | compile: configure
|
|---|
| 59 | @$(CMD_TRACE) "compiling... "
|
|---|
| 60 | @$(MAKE) compile-targets $(MAKE_TRACE)
|
|---|
| 61 |
|
|---|
| 62 | install-targets:
|
|---|
| 63 | install:
|
|---|
| 64 | @$(CMD_TRACE) "installing... "
|
|---|
| 65 | @$(MAKE) install-targets $(MAKE_TRACE)
|
|---|
| 66 |
|
|---|
| 67 | $(WRKBUILD)/.configured:
|
|---|
| 68 | $(WRKBUILD)/.built:
|
|---|
| 69 |
|
|---|
| 70 | $(PACKAGE_DIR):
|
|---|
| 71 | mkdir -p $@
|
|---|
| 72 |
|
|---|
| 73 | clean-targets:
|
|---|
| 74 | clean:
|
|---|
| 75 | @$(CMD_TRACE) "cleaning... "
|
|---|
| 76 | @$(MAKE) clean-targets $(MAKE_TRACE)
|
|---|
| 77 | rm -rf ${WRKDIR}
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 | .PHONY: all source prepare compile install clean
|
|---|