1 # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
21 sysdep_headers := $(sysdep_headers) sys/param.h
22 dont_distribute := $(dont_distribute) sys/param.h # Generated.
26 before-compile := $(before-compile) $(objpfx)sys/param.h
28 $(objpfx)sys/param.h: $(sysincludedir)/sys/param.h
30 (echo '#ifndef _GNU_SYS_PARAM_H'; \
31 echo '#define _GNU_SYS_PARAM_H 1'; \
33 '/^#define[ ]*NULL/ { print "#ifndef NULL"; \
37 { if (!was_null) print $$0; \
39 echo '#endif /* sys/param.h */') > $@-tmp
42 $(objpfx)param.h.c: $(sysincludedir)/sys/param.h
45 $(objpfx)param.h.dep: $(objpfx)param.h.c $(sysdep_dir)/unix/Makefile
46 $(+mkdep) -I$(sysincludedir) $< \
50 -e 's@$(sysincludedir)/*@@g' \
52 -e 's@^@sys/param.h-includes := $$(sys/param.h-includes) @'
56 # Install system headers the system sys/param.h uses.
58 include $(objpfx)param.h.dep
60 # Don't preempt our own headers.
61 sys/param.h-includes := \
62 $(filter-out $(wildcard $(addprefix $(..),$(sys/param.h-includes))),\
63 $(sys/param.h-includes))
65 headers := $(headers) $(sys/param.h-includes)
66 dont_distribute := $(dont_distribute) $(sys/param.h-includes) # Generated.
68 ifdef sys/param.h-includes
69 # Copy the system files to $(objdir).
70 $(addprefix $(objpfx),$(sys/param.h-includes)): $(objpfx)%: $(sysincludedir)/%
77 ifeq "$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/errnos.h))))" \
79 # These need to exist before any compiling is done,
80 # so cpp doesn't instead find the stub versions.
81 before-compile := $(before-compile) $(objpfx)errnos.h
83 $(objpfx)errnos.h: $(objpfx)make-errnos
84 $(dir $<)$(notdir $<) > $@-tmp
87 $(objpfx)make-errnos: $(objpfx)make-errnos.c
88 cd $(objdir); $(CC) $(<:$(objpfx)%=%) -o $(@:$(objpfx)%=%)
90 $(objpfx)make-errnos.c: $(sysdep_dir)/unix/errnos-tmpl.c \
91 $(sysdep_dir)/unix/errnos.awk $(objpfx)errnos
92 awk -f $(word 2,$^) errnos="`tr '\012' ' ' < $(word 3,$^)`" $< > $@-tmp
95 $(objpfx)errnos: $(wildcard $(sysincludedir)/errno.h \
96 $(sysincludedir)/sys/errno.h)
97 cat $^ | sed -n 's/^#define[ ]*\(E[A-Z0-9]*\)[ ]*[0-9][0-9]*[ ]*.*$$/\1/p' > $@-tmp
101 ifeq "$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/ioctls.h))))" \
102 "$(sysdep_dir)/stub/"
103 before-compile := $(before-compile) $(objpfx)ioctls.h
105 $(objpfx)ioctls.h: $(objpfx)make-ioctls
106 $(dir $<)$(notdir $<) > $@-tmp
109 $(objpfx)make-ioctls: $(objpfx)make-ioctls.c
110 cd $(objdir); $(CC) $(<:$(objpfx)%=%) -o $(@:$(objpfx)%=%)
112 $(objpfx)make-ioctls.c: $(sysdep_dir)/unix/ioctls-tmpl.c \
113 $(sysdep_dir)/unix/ioctls.awk $(objpfx)ioctls
114 awk -f $(word 2,$^) requests="`cat $(word 3,$^)`" $< > $@-tmp
117 $(objpfx)ioctls: $(sysdep_dir)/unix/snarf-ioctls $(sysincludedir)/sys/ioctl.h
118 $(dir $<)$(notdir $<) $(word 2,$^) | tr '\012' ' ' > $@-tmp
122 ifeq ($(subdir),stdio)
124 before-compile: $(objpfx)errlist.c
125 $(objpfx)errlist.c: $(objpfx)make_errlist
130 $(objpfx)make_errlist: $(sysdep_dir)/unix/make_errlist.c