summaryrefslogtreecommitdiff
path: root/toolchain/newlib/Makefile
blob: abe15310748c0671896e5e23fdf55adb4c672b00 (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
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.

include $(ADK_TOPDIR)/rules.mk
include ../rules.mk
include Makefile.inc
include ${ADK_TOPDIR}/mk/buildhlp.mk

NEWLIB_CONFIGURE_ARGS:=	--enable-newlib-io-long-long \
			--enable-newlib-register-fini \
			--disable-newlib-supplied-syscalls

ifeq ($(ADK_TARGET_OS_FROSTED),y)
NEWLIB_CONFIGURE_ARGS+=	--enable-newlib-fvwrite-in-streamio=no \
			--enable-newlib-fseek-optimization=no \
			--enable-newlib_wide_orient=no \
			--enable-newlib-unbuf-stream-opt=yes
TARGET_CFLAGS+="-DREENTRANT_SYSCALLS_PROVIDED"
endif
	

$(WRKBUILD)/.configured:
	(cd $(WRKBUILD); \
		CC='' \
		CFLAGS='' \
		LDFLAGS='' \
		CFLAGS_FOR_TARGET='$(TARGET_CFLAGS)' \
		./configure --prefix=/usr \
		--target=$(GNU_TARGET_NAME) \
		--disable-nls \
		$(NEWLIB_CONFIGURE_ARGS) \
	)
	touch $@

$(WRKBUILD)/.compiled:
	PATH='$(HOST_PATH)' $(MAKE) -C $(WRKBUILD) \
		CC='' \
		CFLAGS='' \
		CFLAGS_FOR_TARGET='$(TARGET_CFLAGS)' \
		all
	touch $@

$(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
	PATH='$(HOST_PATH)' $(MAKE) -C $(WRKBUILD) \
		CC='' \
		CFLAGS='' \
		CFLAGS_FOR_TARGET='$(TARGET_CFLAGS)' \
		DESTDIR=$(STAGING_TARGET_DIR) \
		install
	touch $@

include ${ADK_TOPDIR}/mk/toolchain.mk