summaryrefslogtreecommitdiffstats
path: root/rules/newlib.make
blob: ccc55246cfe5efba831203a542e35c39a5a523fa (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*-makefile-*-
# $Id$
#
# Copyright (C) 2007 by Sascha Hauer
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_NEWLIB) += newlib

#
# Paths and names
#
NEWLIB_VERSION	:= $(call remove_quotes,$(PTXCONF_NEWLIB_VERSION))
NEWLIB		:= newlib-$(NEWLIB_VERSION)
NEWLIB_SUFFIX	:= tar.gz
NEWLIB_URL	:= ftp://sources.redhat.com/pub/newlib/$(NEWLIB).$(NEWLIB_SUFFIX)
NEWLIB_SOURCE	:= $(SRCDIR)/$(NEWLIB).$(NEWLIB_SUFFIX)
NEWLIB_DIR	:= $(BUILDDIR_DEBUG)/$(NEWLIB)
NEWLIB_BUILDDIR	:= $(BUILDDIR)/$(NEWLIB)-build

# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

$(NEWLIB_SOURCE):
	@$(call targetinfo)
	@$(call get, NEWLIB)

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

$(STATEDIR)/newlib.extract:
	@$(call targetinfo)
	@$(call clean, $(NEWLIB_DIR))
	@$(call extract, NEWLIB, $(BUILDDIR_DEBUG))
	@$(call patchin, NEWLIB, $(NEWLIB_DIR))
	@$(call touch)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

NEWLIB_PATH := PATH=$(CROSS_PATH)
NEWLIB_ENV := CC_FOR_BUILD=$(HOSTCC)

#
# autoconf
#
NEWLIB_AUTOCONF := \
	--prefix=$(PTXCONF_SYSROOT_CROSS) \
	--target=$(PTXCONF_GNU_TARGET) \
	--disable-shared \
	--disable-newlib-supplied-syscalls \
	--with-newlib

$(STATEDIR)/newlib.prepare:
	@$(call targetinfo)
	@$(call clean, $(NEWLIB_BUILDDIR))
	mkdir -p $(NEWLIB_BUILDDIR)
	cd $(NEWLIB_BUILDDIR) && \
		$(NEWLIB_ENV) $(NEWLIB_PATH) \
		$(NEWLIB_DIR)/configure $(NEWLIB_AUTOCONF)
	@$(call touch)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

$(STATEDIR)/newlib.compile:
	@$(call targetinfo)
	cd $(NEWLIB_BUILDDIR) && $(NEWLIB_PATH) \
		$(MAKE) $(PARALLELMFLAGS)
	@$(call touch)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

$(STATEDIR)/newlib.install:
	@$(call targetinfo)
	cd $(NEWLIB_BUILDDIR) && \
		$(NEWLIB_PATH) $(MAKE) install
	@$(call touch)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

$(STATEDIR)/newlib.targetinstall:
	@$(call targetinfo)
	@$(call touch)

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

newlib_clean:
	rm -rf $(STATEDIR)/newlib.*
	rm -rf $(NEWLIB_DIR)

# vim: syntax=make