bzip2 the i4l patch, because cvs corrupts it ($Id: $ stuff)
[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 # Enable loader and prepare kernel
33 ifeq ($(strip $(BR2_PACKAGE_LOADER)),y)
34 export LINUX_LOADER=$(BUILD_DIR)/lzmaldr
35 export LINUX_IMAGE=$(BUILD_DIR)/piggy.lzma
36 else
37 export LINUX_IMAGE=$(BUILD_DIR)/piggy.gz
38 endif
39
40 $(BUILD_DIR)/piggy.lzma: $(LINUX_KERNEL)
41 cat $^ | $(BUILD_DIR)/lzma/lzma e -si -so -eos > $@ || (rm -f $@ && false)
42
43 $(BUILD_DIR)/piggy.gz: $(LINUX_KERNEL)
44 cat $^ | gzip -c9 $^ > $@ || (rm -f $@ && false)
45
46 TARGET_DIRS:=
47 TARGET_FS:=
48 IMAGE_TARGETS:=
49 ifeq ($(strip $(BR2_TARGET_ROOTFS_JFFS2)),y)
50 TARGET_DIRS += jffs2
51 TARGET_FS += jffs2
52 endif
53 ifeq ($(strip $(BR2_TARGET_ROOTFS_SQUASHFS_LZMA)),y)
54 TARGET_DIRS += squashfs-lzma
55 TARGET_FS += squashfs
56 endif
57 $(foreach fs,$(TARGET_FS),$(eval $(call IMAGE_template,$(fs))))
58
59 INSTALL_TARGET_DIRS:=$(patsubst %,%-install,$(TARGET_DIRS))
60 $(INSTALL_TARGET_DIRS): image_clean $(TARGET_DIR)/etc/sysconf $(BIN_DIR)
61
62 prepare: $(patsubst %,%-prepare,$(TARGET_DIRS))
63 mkdir -p $(TARGET_DIR)
64 if [ -f "$(TARGET_SKELETON)" ] ; then \
65 zcat $(TARGET_SKELETON) | tar -C $(BUILD_DIR) -xf -; \
66 fi;
67 if [ -d "$(TARGET_SKEL_DIR)" ] ; then \
68 cp -a $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \
69 fi;
70 mkdir -p $(TARGET_DIR)/jffs
71 mkdir -p $(TARGET_DIR)/dev
72 mkdir -p $(TARGET_DIR)/proc
73 mkdir -p $(TARGET_DIR)/tmp
74 mkdir -p $(TARGET_DIR)/lib
75 mkdir -p $(TARGET_DIR)/usr/lib
76 mkdir -p $(TARGET_DIR)/usr/bin
77 ln -sf /tmp/resolv.conf $(TARGET_DIR)/etc/resolv.conf
78 rm -rf $(TARGET_DIR)/var
79 ln -sf /tmp $(TARGET_DIR)/var
80 -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
81 -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
82
83 $(BIN_DIR):
84 mkdir -p $(BIN_DIR)
85
86 compile: $(patsubst %,%-compile,$(TARGET_DIRS))
87 install: utils-install lzma-install $(LINUX_IMAGE) $(patsubst %,%-install,$(TARGET_DIRS)) $(IMAGE_TARGETS)
88 clean: $(patsubst %,%-clean,$(TARGET_DIRS)) image_clean
89
90 image_clean:
91 rm -f $(BIN_DIR)/openwrt-*
92
93 $(TARGET_DIR)/etc/sysconf:
94 mkdir -p $(TARGET_DIR)/etc
95 -grep \^BR2_SYSCONF $(TOPDIR)/.config > $(TARGET_DIR)/etc/sysconf
96
97 %-clean:
98 $(MAKE) -C $(patsubst %-clean,%,$@) clean
99 %-prepare:
100 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
101 %-compile: %-prepare
102 $(MAKE) -C $(patsubst %-compile,%,$@) compile
103 %-install: %-compile
104 $(MAKE) -C $(patsubst %-install,%,$@) install
105
106
This page took 0.043077 seconds and 5 git commands to generate.