source: trunk/openwrt/target/Makefile @ 1149

Last change on this file since 1149 was 1149, checked in by nbd, 11 years ago

add rebuild target for the linux directory

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1include $(TOPDIR)/rules.mk
2
3# Default target skeleton stuff, may be overridden
4TARGET_SKEL_DIR=default/target_skeleton
5
6all: install
7
8define BIN_template
9$(BIN_DIR)/openwrt-wrt54g-$(1).bin: $(BIN_DIR)/openwrt-brcm-2.4-$(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-brcm-2.4-$(patsubst jffs2,jffs2-8MB,$(1)).trx
14        PATH=$(TARGET_PATH) addpattern -2 -i $$< -o $$@ -g
15       
16ifeq ($(BR2_TARGET_WRT54G),y)
17IMAGE_TARGETS += $(BIN_DIR)/openwrt-wrt54g-$(1).bin
18endif
19ifeq ($(BR2_TARGET_WRT54GS),y)
20IMAGE_TARGETS += $(BIN_DIR)/openwrt-wrt54gs-$(1).bin
21endif
22
23
24$(BIN_DIR)/openwrt-motorola-$(1).bin: $(BIN_DIR)/openwrt-brcm-2.4-$(patsubst jffs2,jffs2-8MB,$(1)).trx
25        PATH=$(TARGET_PATH) motorola-bin $$< $$@
26
27ifeq ($(BR2_TARGET_MOTOROLA),y)
28IMAGE_TARGETS += $(BIN_DIR)/openwrt-motorola-$(1).bin
29endif
30endef
31
32TARGET_DIRS:=
33TARGET_FS:=
34IMAGE_TARGETS:=
35ifeq ($(strip $(BR2_TARGET_ROOTFS_JFFS2)),y)
36TARGET_DIRS += jffs2
37TARGET_FS += jffs2
38endif
39ifeq ($(strip $(BR2_TARGET_ROOTFS_SQUASHFS_LZMA)),y)
40TARGET_DIRS += squashfs-lzma
41TARGET_FS += squashfs
42endif
43$(foreach fs,$(TARGET_FS),$(eval $(call BIN_template,$(fs))))
44
45INSTALL_TARGET_DIRS:=$(patsubst %,%-install,$(TARGET_DIRS))
46$(INSTALL_TARGET_DIRS): image_clean $(TARGET_DIR)/etc/sysconf $(BIN_DIR)
47
48prepare: $(patsubst %,%-prepare,$(TARGET_DIRS)) $(TARGET_DIR)
49
50$(TARGET_DIR):
51        mkdir -p $(TARGET_DIR)
52        if [ -f "$(TARGET_SKELETON)" ] ; then \
53        zcat $(TARGET_SKELETON) | tar -C $(BUILD_DIR) -xf -; \
54        fi;
55        if [ -d "$(TARGET_SKEL_DIR)" ] ; then \
56                cp -a $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \
57        fi;
58        mkdir -p $(TARGET_DIR)/jffs
59        mkdir -p $(TARGET_DIR)/dev
60        mkdir -p $(TARGET_DIR)/proc
61        mkdir -p $(TARGET_DIR)/tmp
62        mkdir -p $(TARGET_DIR)/lib
63        mkdir -p $(TARGET_DIR)/usr/lib
64        mkdir -p $(TARGET_DIR)/usr/bin
65        ln -sf /tmp/resolv.conf $(TARGET_DIR)/etc/resolv.conf
66        rm -rf $(TARGET_DIR)/var
67        ln -sf /tmp $(TARGET_DIR)/var
68        -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
69        -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
70
71$(BIN_DIR):
72        mkdir -p $(BIN_DIR)
73
74$(INSTALL_TARGET_DIRS): lzma-loader-compile linux-install
75$(IMAGE_TARGETS): $(patsubst %,%-install,$(TARGET_DIRS) linux)
76compile: $(patsubst %,%-compile,jffs2 lzma squashfs-lzma lzma-loader utils linux)
77install: utils-install lzma-install $(patsubst %,%-install,$(TARGET_DIRS) linux) $(IMAGE_TARGETS)
78clean: $(patsubst %,%-clean,$(TARGET_DIRS) linux) image_clean
79
80image_clean:
81        rm -f $(BIN_DIR)/openwrt-*
82
83$(TARGET_DIR)/etc/sysconf:
84        mkdir -p $(TARGET_DIR)/etc
85        -grep \^BR2_SYSCONF $(TOPDIR)/.config > $(TARGET_DIR)/etc/sysconf
86
87%-clean:
88        $(MAKE) -C $(patsubst %-clean,%,$@) clean
89%-prepare:
90        $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
91%-compile: %-prepare
92        $(MAKE) -C $(patsubst %-compile,%,$@) compile
93%-rebuild:
94        $(MAKE) -C $(patsubst %-rebuild,%,$@) rebuild
95%-install: %-compile
96        $(MAKE) -C $(patsubst %-install,%,$@) install
97
98
Note: See TracBrowser for help on using the repository browser.