1 # Generate argz.c and argz.in.h from glibc sources.
4 glibc_dir = /mirror/d/glibc
7 append addsep ctsep insert next stringify count \
8 extract create delete replace
9 argz_files = $(patsubst %, $(glibc_dir)/string/argz-%.c, $(argz_names))
13 "/* Functions for dealing with '\0' separated arg vectors." \
14 " Copyright (C) 1995-1998, 2000-2002, 2006, 2009-2012 Free Software
16 " This file is part of the GNU C Library." \
18 " This program is free software; you can redistribute it and/or modify"\
19 " it under the terms of the GNU General Public License as published by"\
20 " the Free Software Foundation; either version 2, or (at your option)"\
21 " any later version." \
23 " This program is distributed in the hope that it will be useful," \
24 " but WITHOUT ANY WARRANTY; without even the implied warranty of" \
25 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" \
26 " GNU General Public License for more details." \
28 " You should have received a copy of the GNU General Public License along"\
29 " with this program; if not, see <http://www.gnu.org/licenses/>. */" \
31 "#include <config.h>" \
34 "#include <errno.h>" \
35 "#include <stdlib.h>" \
39 targets = argz.c argz.in.h
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 $@
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__//;' \
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;' \