Makefile 3.13 KB
Newer Older
Ryan Jackson's avatar
Ryan Jackson committed
1
MFS_ARCH	=	i386
Ryan Jackson's avatar
Ryan Jackson committed
2 3
SOURCE_PATH	=	$(PWD)/source
TARGET_PATH	=	$(PWD)/target
4
TARGET_BUILD_PATH	=	$(PWD)/build
Ryan Jackson's avatar
Ryan Jackson committed
5 6
SCRIPTS_PATH	=	$(PWD)/scripts
INITRAMFS_PATH	=	$(PWD)/initramfs.tmp
7 8
BUILDROOT_VERSION	=	2010.02
BUILDROOT_PATH		=	$(PWD)/buildroot-$(BUILDROOT_VERSION)
Ryan Jackson's avatar
Ryan Jackson committed
9
FAKEROOT_ENVIRONMENT	=	$(PWD)/fs_fakeroot.env
10
STAGING_DIR	=	$(PWD)/buildroot/build_$(MFS_ARCH)/staging_dir
Ryan Jackson's avatar
Ryan Jackson committed
11
BOOT_PATH	=	$(PWD)/boot
12 13
INITRAMFS_COMPRESSION	=	lzma
INITRAMFS	=	$(BOOT_PATH)/initramfs
14

15 16 17
#FAKEROOT_BIN	=	$(STAGING_DIR)/usr/bin/fakeroot
FAKEROOT_BIN	=	fakeroot

Ryan Jackson's avatar
Ryan Jackson committed
18
MODULES := busybox zlib linux dropbear testbed hdparm target_template sudo \
Ryan Jackson's avatar
Ryan Jackson committed
19
       	e2fsprogs openssl wget perl portmap file ethtool ncurses jove tcsh
Ryan Jackson's avatar
Ryan Jackson committed
20
#MODULES := busybox zlib linux dropbear testbed hdparm target_template sudo e2fsprogs openssl wget portmap file
Ryan Jackson's avatar
Ryan Jackson committed
21
INSTALL_MODULES := $(addsuffix -install,$(MODULES))
Ryan Jackson's avatar
Ryan Jackson committed
22 23
EXTRACT_MODULES := $(addsuffix -extract,$(MODULES) toolchain)
PATCH_MODULES := $(addsuffix -patch,$(MODULES) toolchain)
Ryan Jackson's avatar
Ryan Jackson committed
24
CONFIG_MODULES := $(addsuffix -config,$(MODULES) toolchain)
Ryan Jackson's avatar
Ryan Jackson committed
25
CLEAN_MODULES := $(addsuffix -clean,$(MODULES) toolchain)
26

Ryan Jackson's avatar
Ryan Jackson committed
27 28 29
.PHONY: all clean install root-template-install devices \
	root-base root-install $(MODULES) $(INSTALL_MODULES) \
	$(CLEAN_MODULES) initramfs
30

Ryan Jackson's avatar
Ryan Jackson committed
31
all: $(MODULES) initramfs
32

Ryan Jackson's avatar
Ryan Jackson committed
33
install: uclibc-install $(INSTALL_MODULES)
34
	cp $(SCRIPTS_PATH)/remove_unneeded_modules.pl $(BOOT_PATH)
35

Ryan Jackson's avatar
Ryan Jackson committed
36 37 38 39 40 41 42
clean:
	rm -rf $(TARGET_PATH)
	rm -f $(FAKEROOT_ENVIRONMENT)
	rm -rf $(INITRAMFS_PATH)
	rm -f $(INITRAMFS)
	rm -rf $(TARGET_BUILD_PATH)
	rm -rf $(BOOT_PATH)
43

44 45 46 47
toolchain: $(BUILDROOT_PATH)/toolchain-built

$(BUILDROOT_PATH)/toolchain-built:
	$(MAKE) -C $(SOURCE_PATH)/toolchain all
Ryan Jackson's avatar
Ryan Jackson committed
48 49
	$(MAKE) -C $(SOURCE_PATH)/zlib install-sysroot
	$(MAKE) -C $(SOURCE_PATH)/openssl install
Ryan Jackson's avatar
Ryan Jackson committed
50
	$(MAKE) -C $(SOURCE_PATH)/ncurses install
51
	touch $(BUILDROOT_PATH)/toolchain-built
Ryan Jackson's avatar
Ryan Jackson committed
52 53

$(MODULES): toolchain
Ryan Jackson's avatar
Ryan Jackson committed
54
	$(MAKE) -C $(SOURCE_PATH)/$@ all
55

Ryan Jackson's avatar
Ryan Jackson committed
56 57
$(CLEAN_MODULES):
	$(MAKE) -C $(SOURCE_PATH)/$(subst -clean,,$@) clean
58

59 60 61 62 63 64
$(EXTRACT_MODULES):
	$(MAKE) -C $(SOURCE_PATH)/$(subst -extract,,$@) extract

$(PATCH_MODULES):
	$(MAKE) -C $(SOURCE_PATH)/$(subst -patch,,$@) patch

Ryan Jackson's avatar
Ryan Jackson committed
65 66 67
$(CONFIG_MODULES):
	$(MAKE) -C $(SOURCE_PATH)/$(subst -config,,$@) config

Ryan Jackson's avatar
Ryan Jackson committed
68 69
$(INSTALL_MODULES):
	$(MAKE) -C $(SOURCE_PATH)/$(subst -install,,$@) install
70

Ryan Jackson's avatar
Ryan Jackson committed
71
$(TARGET_PATH)/lib/libc.so.0:
72
	mkdir -p $(TARGET_PATH)/lib
73
	cp -dpR $(BUILDROOT_PATH)/output/target/lib/* $(TARGET_PATH)/lib
74

Ryan Jackson's avatar
Ryan Jackson committed
75
uclibc-install: $(TARGET_PATH)/lib/libc.so.0
76 77 78 79

$(FAKEROOT_ENVIRONMENT):
	touch $@

Ryan Jackson's avatar
Ryan Jackson committed
80 81 82 83 84
initramfs: install
	rm -rf $(INITRAMFS_PATH)
	cp -dpR $(TARGET_PATH) $(INITRAMFS_PATH)
	cat /dev/null > $(FAKEROOT_ENVIRONMENT)
	rm -rf $(INITRAMFS_PATH)/dev
85
	$(FAKEROOT_BIN) -s $(FAKEROOT_ENVIRONMENT) \
Ryan Jackson's avatar
Ryan Jackson committed
86 87 88
		-i $(FAKEROOT_ENVIRONMENT) \
		$(SCRIPTS_PATH)/makedevs.sh \
		$(SCRIPTS_PATH)/devices $(INITRAMFS_PATH)
89
	$(FAKEROOT_BIN) -s $(FAKEROOT_ENVIRONMENT) \
Ryan Jackson's avatar
Ryan Jackson committed
90 91
		-i $(FAKEROOT_ENVIRONMENT) \
		$(SCRIPTS_PATH)/fixperms.sh $(INITRAMFS_PATH)
Ryan Jackson's avatar
Ryan Jackson committed
92 93 94
	$(FAKEROOT_BIN) -s $(FAKEROOT_ENVIRONMENT) \
		-i $(FAKEROOT_ENVIRONMENT) \
		$(SCRIPTS_PATH)/misc_fixup.sh $(TARGET_PATH)
95
	$(FAKEROOT_BIN) -i $(FAKEROOT_ENVIRONMENT) \
96
		$(SCRIPTS_PATH)/gen_initramfs.sh -c $(INITRAMFS_COMPRESSION) $(INITRAMFS_PATH) $(INITRAMFS)
Ryan Jackson's avatar
Ryan Jackson committed
97 98
	rm -f $(FAKEROOT_ENVIRONMENT)
	rm -rf $(INITRAMFS_PATH)