summaryrefslogtreecommitdiffstats
path: root/build
blob: 640b96d519dd56ad0496373fb5d34e8e0264250e (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
#!/usr/bin/make -f

include ../source.mk

KBUILD_ARCH = $$(oh-architecture "$${OPK_HOST_ARCH}")

# ProteanOS's GCC is currently broken: "-print-file-name=include" simply prints
# "include".
nsif_shell = $$(shell $$(CC) -print-file-name=include)
nsif_gcc_v = $$($(CC) -v 2>&1 | sed -n '$$s/^gcc version \([0-9]\)\..*$$/\1/p;')
nsif_inc = /usr/include/$(OPK_HOST_ARCH)/gcc/$(nsif_gcc_v)
nsif_sed = 's|^\(NOSTDINC_FLAGS += .*\) $(nsif_shell)$$|\1 '"$(nsif_inc)|;"

nop:
	@:

build:
	set -e; \
	if [ 'x$(OPK_HOST_PLAT)' != 'xdev' ]; then \
		read img_src img_dest <image; \
		oh-autobuild -T "$${img_src}" -- -j "$${JOBS:-1}"; \
	fi
	touch $@

install: build
	set -e; \
	if [ 'x$(OPK_HOST_PLAT)' != 'xdev' ]; then \
		if ! [ -e src/Makefile.orig ]; then \
			mv src/Makefile src/Makefile.orig; \
			sed $(nsif_sed) src/Makefile.orig 1>src/Makefile; \
		fi; \
		read img_src img_dest <image; \
		install -D "src/arch/$(KBUILD_ARCH)/boot/$${img_src}" \
			linux-image.data/boot/$${img_dest}; \
		ln -sf /boot/$${img_dest} linux-image.data/$${img_dest}; \
		install -D src/System.map \
			linux-sysmap.data/boot/System.map; \
		mkdir -p linux-image.data/etc/kernel/preinst.d \
			linux-image.data/etc/kernel/postinst.d \
			linux-image.data/etc/kernel/prerm.d \
			linux-image.data/etc/kernel/postrm.d; \
	fi
	oh-autoinstall -T headers_install -- \
		INSTALL_HDR_PATH="$${PWD}/linux-libc-dev.data/usr"
	find linux-libc-dev.data/usr/include \
		\( -name .install -o -name ..install.cmd \
		-o -name .check -o -name ..check.cmd \) \
		-a -exec rm -f '{}' ';'
	mkdir linux-libc-dev.data/usr/include/$(OPK_HOST_ARCH)
	mv linux-libc-dev.data/usr/include/asm \
		linux-libc-dev.data/usr/include/$(OPK_HOST_ARCH)/asm