Makefile 2.6 KB
Newer Older
Ryan Jackson's avatar
Ryan Jackson committed
1 2
SOURCE_PATH	=	$(PWD)/source
TARGET_PATH	=	$(PWD)/target
3
TARGET_BUILD_PATH	=	$(PWD)/build
Ryan Jackson's avatar
Ryan Jackson committed
4 5 6 7 8 9 10
SCRIPTS_PATH	=	$(PWD)/scripts
INITRAMFS_PATH	=	$(PWD)/initramfs.tmp
BUILDROOT_PATH	=	$(PWD)/buildroot
FAKEROOT_ENVIRONMENT	=	$(PWD)/fs_fakeroot.env
STAGING_DIR	=	$(PWD)/buildroot/build_i386/staging_dir
INITRAMFS	=	$(PWD)/initramfs.gz
BOOT_PATH	=	$(PWD)/boot
11

Ryan Jackson's avatar
Ryan Jackson committed
12
MODULES := busybox zlib linux dropbear testbed hdparm target_template sudo e2fsprogs openssl wget perl
Ryan Jackson's avatar
Ryan Jackson committed
13
INSTALL_MODULES := $(addsuffix -install,$(MODULES))
14 15
EXTRACT_MODULES := $(addsuffix -extract,$(MODULES))
PATCH_MODULES := $(addsuffix -patch,$(MODULES))
Ryan Jackson's avatar
Ryan Jackson committed
16
CLEAN_MODULES := $(addsuffix -clean,$(MODULES))
17

Ryan Jackson's avatar
Ryan Jackson committed
18 19 20
.PHONY: all clean install root-template-install devices \
	root-base root-install $(MODULES) $(INSTALL_MODULES) \
	$(CLEAN_MODULES) initramfs
21

Ryan Jackson's avatar
Ryan Jackson committed
22
all: $(MODULES)
23

Ryan Jackson's avatar
Ryan Jackson committed
24
install: uclibc-install $(INSTALL_MODULES)
25

Ryan Jackson's avatar
Ryan Jackson committed
26 27 28 29 30 31 32
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)
33

Ryan Jackson's avatar
Ryan Jackson committed
34 35
$(MODULES):
	$(MAKE) -C $(SOURCE_PATH)/$@ all
36

Ryan Jackson's avatar
Ryan Jackson committed
37 38
$(CLEAN_MODULES):
	$(MAKE) -C $(SOURCE_PATH)/$(subst -clean,,$@) clean
39

40 41 42 43 44 45
$(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
46 47
$(INSTALL_MODULES):
	$(MAKE) -C $(SOURCE_PATH)/$(subst -install,,$@) install
48

Ryan Jackson's avatar
Ryan Jackson committed
49
$(TARGET_PATH)/lib/libc.so.0:
50 51 52
	mkdir -p $(TARGET_PATH)/lib
	cp -dpR $(BUILDROOT_PATH)/project_build_i386/uclibc/root/lib/* $(TARGET_PATH)/lib

Ryan Jackson's avatar
Ryan Jackson committed
53
uclibc-install: $(TARGET_PATH)/lib/libc.so.0
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

$(FAKEROOT_ENVIRONMENT):
	touch $@

devices: $(FAKEROOT_ENVIRONMENT)
	rm -rf $(TARGET_PATH)/dev
	$(STAGING_DIR)/usr/bin/fakeroot -s $(FAKEROOT_ENVIRONMENT) \
		-i $(FAKEROOT_ENVIRONMENT) \
		$(SCRIPTS_PATH)/makedevs.sh \
		$(SCRIPTS_PATH)/devices $(TARGET_PATH)

permissions: $(FAKEROOT_ENVIRONMENT) devices target-install
	$(STAGING_DIR)/usr/bin/fakeroot -s $(FAKEROOT_ENVIRONMENT) \
		-i $(FAKEROOT_ENVIRONMENT) \
		$(SCRIPTS_PATH)/fixperms.sh $(TARGET_PATH)

Ryan Jackson's avatar
Ryan Jackson committed
70 71 72 73 74 75 76 77 78 79 80 81
initramfs: install
	rm -rf $(INITRAMFS_PATH)
	cp -dpR $(TARGET_PATH) $(INITRAMFS_PATH)
	cat /dev/null > $(FAKEROOT_ENVIRONMENT)
	rm -rf $(INITRAMFS_PATH)/dev
	$(STAGING_DIR)/usr/bin/fakeroot -s $(FAKEROOT_ENVIRONMENT) \
		-i $(FAKEROOT_ENVIRONMENT) \
		$(SCRIPTS_PATH)/makedevs.sh \
		$(SCRIPTS_PATH)/devices $(INITRAMFS_PATH)
	$(STAGING_DIR)/usr/bin/fakeroot -s $(FAKEROOT_ENVIRONMENT) \
		-i $(FAKEROOT_ENVIRONMENT) \
		$(SCRIPTS_PATH)/fixperms.sh $(INITRAMFS_PATH)
82
	$(STAGING_DIR)/usr/bin/fakeroot -i $(FAKEROOT_ENVIRONMENT) \
Ryan Jackson's avatar
Ryan Jackson committed
83 84 85
		$(SCRIPTS_PATH)/gen_initramfs.sh $(INITRAMFS_PATH) $(INITRAMFS)
	rm -f $(FAKEROOT_ENVIRONMENT)
	rm -rf $(INITRAMFS_PATH)