comparison config/argz.mk @ 10162:101fa85f1d56

generate argz.c and argz.in.h from glibc sources * config/argz.mk: New file, with rules to generate the two files. * modules/argz (Depends-on): Add mempcpy, stpcpy, strndup and strnlen. Suggested by David Lutterkort. * m4/argz.m4: Require AC_C_RESTRICT. Check only for the existence of one function, argz_replace, since it seems to have been added most recently. Also, remove the side effect of defining HAVE_ARGZ_* symbols. * lib/argz.c: Now generated directly from glibc sources, rather than imported from libtool. Includes the following additional functions: argz_extract, argz_create, argz_delete, str_append, argz_replace. * lib/argz.in.h: Likewise. * config/srclist.txt: Reflect that argz* files are no longer pulled from libtool.
author Jim Meyering <meyering@redhat.com>
date Tue, 03 Jun 2008 11:42:12 +0200
parents
children b5e42ef33b49
comparison
equal deleted inserted replaced
10161:5d2f07baed4c 10162:101fa85f1d56
1 # Generate argz.c and argz.in.h from glibc sources.
2
3 glibc_dir = ../glibc
4 glibc_dir = /mirror/d/glibc
5
6 argz_names = \
7 append addsep ctsep insert next stringify count \
8 extract create delete replace
9 argz_files = $(patsubst %, $(glibc_dir)/string/argz-%.c, $(argz_names))
10
11 define print-header
12 printf '%s\n' \
13 "/* Functions for dealing with '\0' separated arg vectors." \
14 " Copyright (C) 1995-1998, 2000-2002, 2006 Free Software Foundation, Inc."\
15 " This file is part of the GNU C Library." \
16 "" \
17 " This program is free software; you can redistribute it and/or modify"\
18 " it under the terms of the GNU General Public License as published by"\
19 " the Free Software Foundation; either version 2, or (at your option)"\
20 " any later version." \
21 "" \
22 " This program is distributed in the hope that it will be useful," \
23 " but WITHOUT ANY WARRANTY; without even the implied warranty of" \
24 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" \
25 " GNU General Public License for more details." \
26 "" \
27 " You should have received a copy of the GNU General Public License along"\
28 " with this program; if not, write to the Free Software Foundation," \
29 " Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */"\
30 "" \
31 "#include <config.h>" \
32 "" \
33 "#include <argz.h>" \
34 "#include <errno.h>" \
35 "#include <stdlib.h>" \
36 "#include <string.h>"
37 endef
38
39 targets = argz.c argz.in.h
40
41 all: $(targets)
42
43 argz.c: $(argz_files)
44 ($(print-header); \
45 for i in $^; do \
46 perl -pe 's/__(argz_|st|mem)/$$1/g' $$i \
47 | perl -0x0 -pe 's,/\*(.|\n)+?\*/\n,,' \
48 | grep -vE '^(#include|INTDEF|weak_alias|libc_hidden_def)'; \
49 done) > $@-t && mv $@-t $@
50
51 argz.in.h: $(glibc_dir)/string/argz.h
52 perl -pe 's/__(restrict|const|st|mem)/$$1/g;' \
53 -e 's/\s*__THROW//;' \
54 -e 's/\s*__attribute_pure__//;' \
55 $< \
56 | perl -ne \
57 '/^(#include <features\.h>|__(?:BEGIN|END)_DECLS)/ or print' \
58 | perl -0x3b -pe 's/extern \S+ \*?__argz_(.|\n)*?\)\n*;//' \
59 | perl -pe 's/__(argz_next)/$$1/g;' \
60 > $@-t && mv $@-t $@
61
62 clean:
63 rm -f $(targets)