Uniformize package Makefile
[openwrt.git] / package / shfs / ipkg / rules
1 #!/usr/bin/make -f
2
3 ifneq ($(strip ${IPKG_RULES_INC}),)
4 include $(IPKG_RULES_INC)
5 endif
6
7 ##
8
9 PKG_VERSION := $(shell cat ./ipkg/version)
10 CURRENT_DIR := $(shell pwd)
11 INSTALL_DIR ?= $(CURRENT_DIR)/ipkg-install
12
13 unexport INSTALL_DIR
14
15 I_KMOD_SHFS := ipkg/kmod-shfs
16 I_SHFS_UTILS := ipkg/shfs-utils
17
18 BUILD_DEPS = \
19
20 ##
21
22 all: package
23
24
25 .stamp-configured: $(BUILD_DEPS)
26
27 touch .stamp-configured
28
29
30 .stamp-built: .stamp-configured
31
32 $(MAKE) \
33 OFLAGS="$(TARGET_CFLAGS)" \
34 CC="$(TARGET_CC)" \
35 LINKER="$(TARGET_CC)" \
36 KERNEL="$(LINUX_VERSION)" \
37 KERNEL_SOURCES="$(LINUX_DIR)" \
38 all
39
40 touch .stamp-built
41
42
43 $(INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/shfs.o: .stamp-built
44
45 mkdir -p $(INSTALL_DIR)
46
47 $(MAKE) \
48 ROOT="$(INSTALL_DIR)" \
49 KERNEL="$(LINUX_VERSION)" \
50 KERNEL_SOURCES="$(LINUX_DIR)" \
51 install
52
53
54 configure: .stamp-configured
55
56
57 build: .stamp-built
58
59
60 install: $(INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/shfs.o
61
62
63 package: $(INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/shfs.o
64
65 mkdir -p $(I_KMOD_SHFS)/lib/modules/$(LINUX_VERSION)
66 cp -fpR $(INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/kernel/fs/shfs/shfs.o \
67 $(I_KMOD_SHFS)/lib/modules/$(LINUX_VERSION)/
68 $(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note \
69 $(I_KMOD_SHFS)/lib/modules/$(LINUX_VERSION)/*.o
70
71 mkdir -p $(I_SHFS_UTILS)/usr/sbin
72 cp -fpR $(INSTALL_DIR)/usr/sbin/shfs{,u}mount $(I_SHFS_UTILS)/usr/sbin/
73 cp -fpR $(INSTALL_DIR)/usr/sbin/mount.shfs $(I_SHFS_UTILS)/usr/sbin/
74 $(STRIP) $(I_SHFS_UTILS)/usr/sbin/shfs*
75
76 chmod 0755 ipkg/*/CONTROL/
77 chmod 0644 ipkg/*/CONTROL/control
78
79 perl -pi -e "s/^Arch.*:.*/Architecture: $(ARCH)/g" ipkg/*/CONTROL/control
80 ifneq ($(strip $(PKG_VERSION)),)
81 perl -pi -e "s/^Vers.*:.*/Version: $(PKG_VERSION)/g" ipkg/*/CONTROL/control
82 perl -pi -e "s/^Vers.*:.*/Version: $(LINUX_VERSION)+$(PKG_VERSION)/g" $(I_KMOD_SHFS)/CONTROL/control
83 endif
84
85 $(IPKG_BUILD) $(I_KMOD_SHFS) $(IPKG_TARGET_DIR)
86 $(IPKG_BUILD) $(I_SHFS_UTILS) $(IPKG_TARGET_DIR)
87
88
89 clean:
90
91 -$(MAKE) \
92 ROOT="$(INSTALL_DIR)" \
93 KERNEL="$(LINUX_VERSION)" \
94 KERNEL_SOURCES="$(LINUX_DIR)" \
95 uninstall clean
96
97 rm -rf .stamp-* \
98 $(INSTALL_DIR) \
99 $(I_KMOD_SHFS)/lib \
100 $(I_SHFS_UTILS)/usr \
101
102
103 control:
104
105 @cat $(I_KMOD_SHFS)/CONTROL/control
106 @echo
107 @cat $(I_SHFS_UTILS)/CONTROL/control
108 @echo
109
110
111 .PHONY: configure build install package clean control
This page took 0.042451 seconds and 5 git commands to generate.