diff options
Diffstat (limited to 'hurd/Makefile')
-rw-r--r-- | hurd/Makefile | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/hurd/Makefile b/hurd/Makefile new file mode 100644 index 00000000..1b133aaa --- /dev/null +++ b/hurd/Makefile @@ -0,0 +1,79 @@ +# +# Copyright (C) 1993, 94, 95, 96, 99 Free Software Foundation +# +# This program 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, or (at +# your option) any later version. +# +# This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +dir := hurd +makemode := misc + +hdrs = $(wildcard $(srcdir)/*.defs $(srcdir)/*.h) +DIST_FILES = subsystems $(notdir $(hdrs)) ioctl-tmpl.sym ioctl.awk gensym.awk + +INSTHDRS = hurd_types.h ioctl_types.h paths.h shared.h \ + $(notdir $(wildcard $(srcdir)/*.defs)) + +include ../Makeconf + +install-headers install: $(includedir)/hurd \ + $(addprefix $(includedir)/hurd/,$(INSTHDRS)) + +$(includedir)/hurd/%: $(srcdir)/%; $(INSTALL_DATA) $< $@ + +$(includedir)/hurd:;mkdir -p $@ + + + +# +# The following rules assist in creating an `Xioctl.defs' file +# to define RPCs that are sent primarily by ioctl commands. +# To use them, write a file `Xioctl-headers.h', e.g. for `mioctl-headers.h': +# #include <sys/mtio.h> +# with an #include for each header that defines ioctl request macros +# using _IO('X') et al. Then `make Xioctl-proto.defs' will create +# a prototype file for you to hand-edit into `Xioctl.defs'. + +# Building foo.h from foo.sym: +%.symc: %.sym + $(AWK) -f $(srcdir)/gensym.awk $< >$*.symc +%.symc.o: %.symc + $(CC) -S $(CPPFLAGS) $(CFLAGS) $(CPPFLAGS-$@) -x c -o $@ $< +%.h: %.symc.o + sed <$< -e 's/^[^*].*$$//' | \ + sed -e 's/^[*]/#define/' -e 's/mAgIc[^-0-9]*//' -e '/^ *$$/d' >$@ + +%-ioctls.sym: tmpl-ioctls.sym + sed 's|HEADER|<$(subst +,/,$*)>|' $< > $@ + +cpp = $(CC) $(CPPFLAGS) $(CFLAGS) $(CPPFLAGS-$@) -E -x c + +%ioctl-requests.list: %ioctl-headers.h + $(cpp) $< | sed -n 's/^#.*"\([^"]*\)".*$$/\1/p' | sort | uniq | \ + while read f; do \ + sed -n 's/^[ ]*#[ ]*define[ ]*\([A-Z0-9_]*\)[^A-Z0-9_][^A-Z0-9_]*_IO.*'\'$*\'.*$$'/\1/p' $$f; \ + done | sort | uniq > $@ + +%ioctl.defs: %ioctl.sym + +%ioctl-values.sym: %ioctl-headers.h %ioctl-requests.list ioctl-tmpl.sym + (sed 's%@HEADER_LIST@%$<%;s/@GROUP@/$*/g' < $(filter %.sym,$^); \ + while read r; do \ + for x in CMD SUBID INOUT TYPE \ + TYPE0 TYPE1 TYPE2 COUNT0 COUNT1 COUNT2; do \ + echo "expr $${x}($${r}) $${r}_$${x}"; \ + done; \ + done < $(filter %.list,$^)) > $@ + +%ioctl-proto.defs: %ioctl-values.h ioctl.awk + sed 's/^#define//;s/_/ /g' $< | $(AWK) -f $(filter %.awk,$^) > $@ |