summaryrefslogtreecommitdiffstats
path: root/build
blob: 2431af3ef67f68b90c091dc48356ccbcb7523a87 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/make -f

BASE_VERSION = $$(printf '%s\n' '$(OPK_SOURCE)' | sed 's/^gcc-//')

COMMON_OPTS = \
	--with-pkgversion='GCC for ProteanOS' \
	--program-suffix="-$(BASE_VERSION)" \
	--enable-linker-build-id \
	--with-system-zlib \
	--disable-multilib \
	--without-included-gettext \
	--with-nls \
	--with-sysroot="$${OPK_SYSROOT:-/}" \
	--enable-clocale=gnu

FULL_OPTS = \
	$(COMMON_OPTS) \
	--enable-shared \
	--enable-threads=posix \
	--enable-languages=c,c++

BOOTSTRAP1_OPTS = \
	$(COMMON_OPTS) \
	--without-headers \
	--with-newlib \
	--disable-shared \
	--disable-threads \
	--enable-languages=c,c++ \
	--disable-libgomp \
	--disable-libmudflap \
	--disable-libssp

nop:
	@:

configure:
	if [ 'x$(OPK_HOST_PLAT)' = 'xbootstrap1' ]; then \
		oh-autoconfigure -B gcc-build -- \
		$(BOOTSTRAP1_OPTS); \
	else \
		oh-autoconfigure -B gcc-build -- \
		$(FULL_OPTS); \
	fi
	touch $@

build: configure
	# TODO: This should be done in the source target.
	for f in \
			gcc/doc/gcc.texi gcc/doc/invoke.texi gcc/doc/gcov.texi \
			gcc/doc/include/funding.texi gcc/doc/gccint.texi \
			libgomp/libgomp.texi; do \
		>src/$${f}; \
	done
	oh-autobuild -B gcc-build -T bootstrap-lean -- -j $${JOBS:-1}
	touch $@

install: build
	# The -T option is necessary because otherwise:
	#   * oh-autoinstall checks for an "install" target by running make with
	#     the -n option,
	#   * Many commands in GCC makefiles contain the "$(MAKE)" macro
	#     expansion, and
	#   * GNU Make executes any commands that contain "$(MAKE)", even if -n
	#     is specified.
	# See also: <http://gcc.gnu.org/ml/gcc/2013-04/msg00171.html>.
	oh-autoinstall -B gcc-build -T install

# POSIX.1-2008:
#   If the pathname does not begin with a '/' it shall be treated as relative to
#   the current working directory of the process, not relative to the directory
#   containing the makefile.
include ../source.mk