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

CFLAGS = -g -O2

configure: configure.stamp
configure.stamp:
	mkdir build
	# Generate the main makefile.
	# Use shared BFD and opcodes libraries for all utilities.
	# Don't enable multilib (multiarch is better).
	# Enable plugins.
	# Don't expect to find Gettext.
	cd build && \
		target_arch_gnu=$$(oh-getarchitecture -t gnu $(PKG_TARGET_ARCH)) && \
		CFLAGS='$(CFLAGS)' ../src/configure \
		--prefix=/usr --with-sysroot=/ \
		--program-transform-name='s&^&$(PKG_TARGET_ARCH)-&' \
		--enable-shared --disable-multilib \
		--enable-plugins --disable-nls \
		--build=$(OH_BUILD_ARCH_GNU) --host=$(OH_HOST_ARCH_GNU) \
		--target=$${target_arch_gnu}
	# Generate all the individual program makefiles.
	cd build && make configure-host
	touch $@

build: build.stamp
build.stamp: configure
	# Build BFD header files.
	cd build/bfd && make headers
	# Build ALL the things!
	cd build && make CFLAGS='$(CFLAGS)'
	touch $@

install: install.stamp
install.stamp: build
	# Install everything.
	cd build && \
		make CFLAGS='$(CFLAGS)' prefix="$${PWD}/../dest" install
	# Remove static library dependency metadata generated by libtool.
	rm -f ../dest/usr/lib/*.la
	# Make symbolic links to native utilities.
	if [ '$(OH_HOST_ARCH)' = '$(PKG_TARGET_ARCH)' ]; then \
		for util in ../dest/usr/bin/*; do \
		ln -sf "$(PKG_TARGET_ARCH)-$${util##*/}" "$${util}"; \
		done \
		fi
	touch $@

binary-arch: install
	oh-strip
	oh-installfiles
	oh-installdocs binutils
	oh-gencontrol
	oh-buildopk

binary-indep: install
	oh-installfiles
	oh-installdocs binutils
	oh-gencontrol
	oh-buildopk

binary: binary-arch binary-indep