Makefile 2.32 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
13
14
MODULES := busybox zlib linux testbed hdparm target_template
INSTALL_MODULES := $(addsuffix -install,$(MODULES))
CLEAN_MODULES := $(addsuffix -clean,$(MODULES))
15

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

Ryan Jackson's avatar
Ryan Jackson committed
20
all: $(MODULES)
21

Ryan Jackson's avatar
Ryan Jackson committed
22
install: uclibc-install $(INSTALL_MODULES)
23

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

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

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

Ryan Jackson's avatar
Ryan Jackson committed
38
39
$(INSTALL_MODULES):
	$(MAKE) -C $(SOURCE_PATH)/$(subst -install,,$@) install
40

Ryan Jackson's avatar
Ryan Jackson committed
41
$(TARGET_PATH)/lib/libc.so.0:
42
43
44
	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
45
uclibc-install: $(TARGET_PATH)/lib/libc.so.0
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

$(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
62
63
64
65
66
67
68
69
70
71
72
73
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)
74
	$(STAGING_DIR)/usr/bin/fakeroot -i $(FAKEROOT_ENVIRONMENT) \
Ryan Jackson's avatar
Ryan Jackson committed
75
76
77
		$(SCRIPTS_PATH)/gen_initramfs.sh $(INITRAMFS_PATH) $(INITRAMFS)
	rm -f $(FAKEROOT_ENVIRONMENT)
	rm -rf $(INITRAMFS_PATH)