add common functions for the new config file format
[openwrt.git] / openwrt / package / base-files / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=base-files
6 PKG_RELEASE:=6
7 PKG_BUILD_DIR:=$(BUILD_DIR)/base-files
8
9 BOARD:=$(shell LANG=C grep ^BR2_LINUX_2 $(TOPDIR)/.config|sed -e "s/=y//" \
10 -e "s/.*_//"| tr "[:upper:]" "[:lower:]")
11 KERNEL:=$(shell LANG=C grep ^BR2_LINUX_2 $(TOPDIR)/.config|sed -e "s/=y//" \
12 -e "s/BR2_LINUX_//" -e "s/_BRCM//" -e "s/_/./"| tr "[:upper:]" "[:lower:]")
13
14 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
15 ifeq ($(REV),)
16 REV:=0
17 endif
18
19 include $(TOPDIR)/package/rules.mk
20
21 IDIR_BASE:=$(PKG_BUILD_DIR)/base-files
22 IPKG_BASE:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_RELEASE)_$(ARCH).ipk
23
24 UCLIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_version}
25 IDIR_UCLIBC:=$(PKG_BUILD_DIR)/uclibc
26 IPKG_UCLIBC:=$(PACKAGE_DIR)/uclibc_$(UCLIBC_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
27
28 LIBGCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version}
29 IDIR_LIBGCC:=$(PKG_BUILD_DIR)/libgcc
30 IPKG_LIBGCC:=$(PACKAGE_DIR)/libgcc_$(LIBGCC_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
31
32 PACKAGES:=$(IPKG_BASE) $(IPKG_UCLIBC)
33 PACKAGES_INSTALL:=$(IPKG_BASE) $(IPKG_UCLIBC)
34
35 ifeq ($(BR2_PACKAGE_LIBGCC),y)
36 PACKAGES+=$(IPKG_LIBGCC)
37 PACKAGES_INSTALL+=$(IPKG_LIBGCC)
38 endif
39 ifeq ($(BR2_PACKAGE_LIBGCC),m)
40 PACKAGES+=$(IPKG_LIBGCC)
41 endif
42
43 $(PKG_BUILD_DIR)/.prepared:
44 mkdir -p $(PKG_BUILD_DIR) $(PACKAGE_DIR)
45 touch $@
46
47 $(PKG_BUILD_DIR)/.configured:
48 touch $@
49
50 $(PKG_BUILD_DIR)/.built:
51 touch $@
52
53 $(IPKG_BASE):
54 $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_BASE) ipkg/$(PKG_NAME).control $(PKG_RELEASE) $(ARCH)
55 $(CP) ./default/* $(IDIR_BASE)
56 $(SED) 's,$$R,r$(REV),g' $(IDIR_BASE)/etc/banner
57 $(SED) 's,$$S,$(BOARD)-$(KERNEL),g' $(IDIR_BASE)/etc/ipkg.conf
58 mkdir -p $(IDIR_BASE)/dev
59 mkdir -p $(IDIR_BASE)/etc/crontabs
60 mkdir -p $(IDIR_BASE)/jffs
61 mkdir -p $(IDIR_BASE)/lib
62 mkdir -p $(IDIR_BASE)/mnt
63 mkdir -p $(IDIR_BASE)/proc
64 mkdir -p $(IDIR_BASE)/tmp
65 mkdir -p $(IDIR_BASE)/usr/lib
66 mkdir -p $(IDIR_BASE)/usr/bin
67 mkdir -p $(IDIR_BASE)/sys
68 mkdir -p $(IDIR_BASE)/www
69 ln -sf /tmp/resolv.conf $(IDIR_BASE)/etc/resolv.conf
70 ln -sf /proc/mounts $(IDIR_BASE)/etc/mtab
71 rm -f $(IDIR_BASE)/var
72 ln -sf /tmp $(IDIR_BASE)/var
73 -find $(IDIR_BASE) -type d -name CVS | xargs rm -rf
74 -find $(IDIR_BASE) -type d -name .svn | xargs rm -rf
75 -find $(IDIR_BASE) -name '.#*' | xargs rm -f
76 mkdir -p $(IDIR_BASE)/etc
77 $(IPKG_BUILD) $(IDIR_BASE) $(PACKAGE_DIR)
78
79 $(IPKG_UCLIBC):
80 $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_UCLIBC) ipkg/uclibc.control $(UCLIBC_VERSION)-$(PKG_RELEASE) $(ARCH)
81 mkdir -p $(IDIR_UCLIBC)/lib
82 for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
83 $(CP) $(STAGING_DIR)/lib/$$file.so.* $(IDIR_UCLIBC)/lib/; \
84 $(CP) $(STAGING_DIR)/lib/$$file-$(UCLIBC_VERSION).so $(IDIR_UCLIBC)/lib/; \
85 done
86 -$(STRIP) $(IDIR_UCLIBC)/lib/*
87 $(IPKG_BUILD) $(IDIR_UCLIBC) $(PACKAGE_DIR)
88
89 $(IPKG_LIBGCC):
90 $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_LIBGCC) ipkg/libgcc.control $(LIBGCC_VERSION)-$(PKG_RELEASE) $(ARCH)
91 mkdir -p $(IDIR_LIBGCC)/lib
92 $(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(IDIR_LIBGCC)/lib/
93 -$(STRIP) $(IDIR_LIBGCC)/lib/*
94 $(IPKG_BUILD) $(IDIR_LIBGCC) $(PACKAGE_DIR)
95
96 package-clean:
97 rm -f $(PACKAGES)
98
99 clean-targets: package-clean
100 prepare:
101 compile-targets: $(PACKAGES)
102 install-targets: compile
103 mkdir -p $(TARGET_DIR)
104 $(IPKG) install $(PACKAGES_INSTALL)
This page took 0.05014 seconds and 5 git commands to generate.