Add an rscript shell script to recursively find strippable binaries and strip unstrip...
[openwrt.git] / openwrt / target / Makefile
1 include $(TOPDIR)/rules.mk
2
3 # Default target skeleton stuff, may be overridden
4 TARGET_SKEL_DIR=default/target_skeleton
5
6 all: install
7
8 define IMAGE_template
9 $(BIN_DIR)/openwrt-wrt54g-$(1).bin: $(BIN_DIR)/openwrt-generic-$(patsubst jffs2,jffs2-4MB,$(1)).trx
10 PATH=$(TARGET_PATH) addpattern -2 -i $$< -o $$@ -g
11 $(SED) "1s,^W54S,W54G," $$@
12
13 $(BIN_DIR)/openwrt-wrt54gs-$(1).bin: $(BIN_DIR)/openwrt-generic-$(patsubst jffs2,jffs2-8MB,$(1)).trx
14 PATH=$(TARGET_PATH) addpattern -2 -i $$< -o $$@ -g
15
16 ifeq ($(BR2_TARGET_WRT54G),y)
17 IMAGE_TARGETS += $(BIN_DIR)/openwrt-wrt54g-$(1).bin
18 endif
19 ifeq ($(BR2_TARGET_WRT54GS),y)
20 IMAGE_TARGETS += $(BIN_DIR)/openwrt-wrt54gs-$(1).bin
21 endif
22
23
24 $(BIN_DIR)/openwrt-motorola-$(1).bin: $(BIN_DIR)/openwrt-generic-$(patsubst jffs2,jffs2-8MB,$(1)).trx
25 PATH=$(TARGET_PATH) motorola-bin $$< $$@
26
27 ifeq ($(BR2_TARGET_MOTOROLA),y)
28 IMAGE_TARGETS += $(BIN_DIR)/openwrt-motorola-$(1).bin
29 endif
30 endef
31
32 $(LINUX_IMAGE): $(LINUX_KERNEL)
33 cat $^ | $(BUILD_DIR)/lzma/lzma e -si -so -eos > $@ || (rm -f $@ && false)
34
35 TARGET_DIRS:=
36 TARGET_FS:=
37 IMAGE_TARGETS:=
38 ifeq ($(strip $(BR2_TARGET_ROOTFS_JFFS2)),y)
39 TARGET_DIRS += jffs2
40 TARGET_FS += jffs2
41 endif
42 ifeq ($(strip $(BR2_TARGET_ROOTFS_SQUASHFS_LZMA)),y)
43 TARGET_DIRS += squashfs-lzma
44 TARGET_FS += squashfs
45 endif
46 $(foreach fs,$(TARGET_FS),$(eval $(call IMAGE_template,$(fs))))
47
48 INSTALL_TARGET_DIRS:=$(patsubst %,%-install,$(TARGET_DIRS))
49 $(INSTALL_TARGET_DIRS): image_clean $(TARGET_DIR)/etc/sysconf $(BIN_DIR)
50
51 prepare: $(patsubst %,%-prepare,$(TARGET_DIRS))
52 mkdir -p $(TARGET_DIR)
53 if [ -f "$(TARGET_SKELETON)" ] ; then \
54 zcat $(TARGET_SKELETON) | tar -C $(BUILD_DIR) -xf -; \
55 fi;
56 if [ -d "$(TARGET_SKEL_DIR)" ] ; then \
57 cp -a $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \
58 fi;
59 mkdir -p $(TARGET_DIR)/jffs
60 mkdir -p $(TARGET_DIR)/dev
61 mkdir -p $(TARGET_DIR)/proc
62 mkdir -p $(TARGET_DIR)/tmp
63 mkdir -p $(TARGET_DIR)/lib
64 mkdir -p $(TARGET_DIR)/usr/lib
65 mkdir -p $(TARGET_DIR)/usr/bin
66 ln -sf /tmp/resolv.conf $(TARGET_DIR)/etc/resolv.conf
67 rm -rf $(TARGET_DIR)/var
68 ln -sf /tmp $(TARGET_DIR)/var
69 -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
70 -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
71
72 $(BIN_DIR):
73 mkdir -p $(BIN_DIR)
74
75 $(INSTALL_TARGET_DIRS): lzma-loader-compile
76 $(IMAGE_TARGETS): $(patsubst %,%-install,$(TARGET_DIRS))
77 compile: $(patsubst %,%-compile,$(TARGET_DIRS))
78 install: utils-install lzma-install $(LINUX_IMAGE) $(patsubst %,%-install,$(TARGET_DIRS)) $(IMAGE_TARGETS)
79 clean: $(patsubst %,%-clean,$(TARGET_DIRS)) image_clean
80
81 image_clean:
82 rm -f $(BIN_DIR)/openwrt-*
83
84 $(TARGET_DIR)/etc/sysconf:
85 mkdir -p $(TARGET_DIR)/etc
86 -grep \^BR2_SYSCONF $(TOPDIR)/.config > $(TARGET_DIR)/etc/sysconf
87
88 %-clean:
89 $(MAKE) -C $(patsubst %-clean,%,$@) clean
90 %-prepare:
91 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
92 %-compile: %-prepare
93 $(MAKE) -C $(patsubst %-compile,%,$@) compile
94 %-install: %-compile
95 $(MAKE) -C $(patsubst %-install,%,$@) install
96
97
This page took 0.04901 seconds and 5 git commands to generate.