summaryrefslogtreecommitdiffstats
path: root/build
blob: 0f0b3c8dda4ce22fab2b3e3ca38ed9c3cecbadbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#! /usr/bin/make -f

include ../source.mk

config_enabled = \
	config_enabled() \
	{ \
		grep "^CONFIG_$${1}=y$$" <src/.config >/dev/null 2>&1; \
	}
install_init_script = \
	install_init_script() \
	{ \
		script="$${1}"; \
		shift; \
		install -p -m 0755 "../src.etc/init.d/$${script}" \
			"dest/etc/init.d/$${script}"; \
		for link; do \
			ln -s "../init.d/$${script}" \
				"dest/etc/rc.d/$${link}$${script}"; \
		done; \
	}

nop:
	@:

build:
	oh-autobuild -- -j $${JOBS:-1}

install:
	oh-autoinstall
	oh-fixperms
	oh-strip
	chmod u+s dest/bin/busybox
	mv dest/usr/bin/ar dest/usr/bin/ar.busybox
	mv dest/usr/bin/strings dest/usr/bin/strings.busybox
	mv dest/usr/bin/clear dest/usr/bin/clear.busybox
	mv dest/usr/bin/reset dest/usr/bin/reset.busybox
	set -e; $(config_enabled); $(install_init_script); \
	if config_enabled INIT; then \
		install -d -m 0755 dest/etc; \
		if config_enabled HALT; then \
			install -p -m 0644 ../src.etc/inittab.halt \
				dest/etc/inittab; \
		else \
			install -p -m 0644 ../src.etc/inittab \
				dest/etc/inittab; \
		fi; \
		install -d -m 0755 dest/etc/init.d dest/etc/rc.d; \
		while read -r config script links; do \
			config_enabled "$${config}" && \
				install_init_script "$${script}" $${links}; \
		done <../scripts; \
	fi; \
	if config_enabled HTTPD; then \
		install -d -m 0755 dest/var/www; \
		install -p -m 0644 ../src.var/www/index.html \
			dest/var/www/index.html; \
	fi
	oh-installfiles