add swedish webif translation
[openwrt/svn-archive/archive.git] / openwrt / package / rules.mk
1 # invoke ipkg with configuration in $(STAGING_DIR)/etc/ipkg.conf
2 IPKG := IPKG_INSTROOT=$(TARGET_DIR) IPKG_CONF_DIR=$(IPKG_CONF) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
3 IPKG_STATE_DIR := $(TARGET_DIR)/usr/lib/ipkg
4
5 define PKG_template
6 IPKG_$(1):=$(PACKAGE_DIR)/$(2)_$(3)_$(4).ipk
7 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(2)
8 INFO_$(1):=$(IPKG_STATE_DIR)/info/$(2).list
9
10 ifneq ($(BR2_PACKAGE_$(1)),)
11 compile-targets: $$(IPKG_$(1))
12 endif
13 ifneq ($(DEVELOPER),)
14 compile-targets: $$(IPKG_$(1))
15 endif
16 ifeq ($(BR2_PACKAGE_$(1)),y)
17 install-targets: $$(INFO_$(1))
18 endif
19
20 IDEPEND_$(1):=$$(strip $(5))
21
22 $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
23 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(IDIR_$(1)) ./ipkg/$(2).control $(3) $(4)
24 if [ "$$(IDEPEND_$(1))" != "" ]; then echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control; fi
25 for file in conffiles preinst postinst prerm postrm; do \
26 [ -f ./ipkg/$(2).$$$$file ] && cp ./ipkg/$(2).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file || true; \
27 done
28
29 $$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(PKG_BUILD_DIR)/.built $(PACKAGE_DIR)
30
31 $$(INFO_$(1)): $$(IPKG_$(1))
32 $(IPKG) install $$(IPKG_$(1))
33
34 $(2)-clean:
35 rm -f $$(IPKG_$(1))
36 clean-targets: $(2)-clean
37 endef
38
39 ifneq ($(strip $(PKG_SOURCE)),)
40 $(DL_DIR)/$(PKG_SOURCE):
41 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
42 endif
43
44 ifneq ($(strip $(PKG_CAT)),)
45 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
46 rm -rf $(PKG_BUILD_DIR)
47 mkdir -p $(PKG_BUILD_DIR)
48 $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) -
49 if [ -d ./patches ]; then \
50 $(PATCH) $(PKG_BUILD_DIR) ./patches ; \
51 fi
52 touch $(PKG_BUILD_DIR)/.prepared
53 endif
54
55 all: compile
56
57 compile-targets:
58 install-targets:
59 clean-targets:
60
61 source: $(DL_DIR)/$(PKG_SOURCE)
62 prepare: $(PKG_BUILD_DIR)/.prepared
63 compile: compile-targets
64 install: install-targets
65 mostlyclean:
66 rebuild:
67 -$(MAKE) mostlyclean
68 if [ -f $(PKG_BUILD_DIR)/.built ]; then \
69 $(MAKE) clean; \
70 fi
71 $(MAKE) compile
72
73 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
74 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
75
76 $(PACKAGE_DIR):
77 mkdir -p $@
78
79 clean: clean-targets
80 rm -rf $(PKG_BUILD_DIR)
81
82 .PHONY: all source prepare compile install clean