summaryrefslogtreecommitdiff
path: root/libc-parts/Makefile.am
blob: d44d24f04783517b8fa81734576a5ef6428ff8f1 (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
# Makefile.am - Makefile template for libc-parts.
# Copyright (C) 2003 Free Software Foundation, Inc.
# Written by Marcus Brinkmann.
#
# This file is part of the GNU Hurd.
# 
# The GNU Hurd is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# The GNU Hurd is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA

noinst_LIBRARIES = libc-parts.a

libc_parts_a_SOURCES = ctype.h c-ctype.h c-ctype.c		\
	errno.h errno.c						\
	strtol.c strtoll.c strtoul.c strtoull.c

# For the following routines we want to take the possibly optimized
# versions from the target's GNU C library, rather than duplicating
# the generic code here.
routines := memcpy memmove memset bcopy bzero memchr rawmemchr	\
	strstr strtok strchr strchrnul strcpy stpcpy strcat	\
	strcmp strncmp strlen strnlen				\
	atoi atoll strtoimax strtoumax				\
	htonl htons ntohl ntohs ffs

# We have to find all modules in the archive which contain the above
# functions.
routines_subexp := 's/^\($(shell echo $(routines) \
	| $(SED) -e 's/ \+/\\|/g')\) in \(.*\)$$/\2/p'
routines_objects := $(shell $(NM) --print-armap @STATIC_GLIBC@ 2>/dev/null \
	| $(SED) -n -e $(routines_subexp) | $(SORT) -u)

# This stupid trick seems to be necessary to avoid early expansion of
# routines_objects in Makefile.in by automake, which doesn't work at all.
routines_varname := routines_objects
libc_parts_a_LIBADD = $($(routines_varname))

$(routines_objects): %.$(OBJEXT): @STATIC_GLIBC@
	$(AR) -x $< $@