-
-# Files related to the fixproto script.
-# gen-protos and fix-header are compiled with CC_FOR_BUILD, but they are only
-# used in native and host-x-target builds, so it's safe to link them with
-# libiberty.a.
-
-deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
- if [ -d "$(SYSTEM_HEADER_DIR)" ]; \
- then \
- CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -isystem include -isystem ${SYSTEM_HEADER_DIR}"; \
- export CC; \
- $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h; \
- mv tmp-deduced.h deduced.h; \
- else \
- $(STAMP) deduced.h; \
- fi
-
-GEN_PROTOS_OBJS = build/gen-protos.o build/scan.o $(BUILD_ERRORS)
-build/gen-protos$(build_exeext): $(GEN_PROTOS_OBJS)
- ${CC_FOR_BUILD} $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
- $(GEN_PROTOS_OBJS) $(BUILD_LIBS)
-
-build/gen-protos.o: gen-protos.c scan.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
- $(GTM_H) errors.h
-
-build/scan.o: scan.c scan.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H)
-
-xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h \
- build/gen-protos$(build_exeext) Makefile
- sed -e s/TARGET_GETGROUPS_T/$(TARGET_GETGROUPS_T)/ \
- deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
- mv tmp-fixtmp.c fixtmp.c
- $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
- | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
- | $(RUN_GEN) build/gen-protos >xsys-protos.hT
- mv xsys-protos.hT xsys-protos.h
- rm -rf fixtmp.c
-
-# This is nominally a 'build' program, but it's run only when host==build,
-# so we can (indeed, must) use $(LIBDEPS) and $(LIBS).
-build/fix-header$(build_exeext): build/fix-header.o build/scan-decls.o \
- build/scan.o xsys-protos.h \
- $(BUILD_ERRORS) $(LIBDEPS)
- $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
- build/fix-header.o incpath.o cppdefault.o build/scan-decls.o prefix.o \
- build/scan.o $(BUILD_ERRORS) $(LIBS)
-
-build/fix-header.o: fix-header.c $(OBSTACK_H) scan.h errors.h \
- xsys-protos.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(CPPLIB_H)
-
-build/scan-decls.o: scan-decls.c scan.h $(CPPLIB_H) $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H)
-
-# stmp-fixproto depends on this, not on fix-header directly.
-# The idea is to make sure fix-header gets built,
-# but not rerun fixproto after each stage
-# just because fix-header's mtime has changed.
-fixhdr.ready: build/fix-header$(build_exeext)
- -if [ -f fixhdr.ready ] ; then \
- true; \
- else \
- $(STAMP) fixhdr.ready; \
- fi
-
-# stmp-int-hdrs is to make sure fixincludes has already finished.
-# The if statement is so that we don't run fixproto a second time
-# if it has already been run on the files in `include-fixed'.
-stmp-fixproto: fixhdr.ready fixproto fixinc_list stmp-int-hdrs
- set -e; for ml in `cat fixinc_list`; do \
- sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
- multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
- fix_dir=include-fixed$${multi_dir}; \
- if [ -f $${fix_dir}/fixed ] ; then true; \
- else \
- : This line works around a 'make' bug in BSDI 1.1.; \
- FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
- FIX_HEADER="build/fix-header$(build_exeext)"; export FIX_HEADER; \
- mkinstalldirs="$(mkinstalldirs)"; \
- export mkinstalldirs; \
- if [ -d "$(SYSTEM_HEADER_DIR)" ]; then \
- $(SHELL) ${srcdir}/fixproto $${fix_dir} $${fix_dir} $(SYSTEM_HEADER_DIR); \
- if [ $$? -eq 0 ] ; then true ; else exit 1 ; fi ; \
- else true; fi; \
- $(STAMP) $${fix_dir}/fixed; \
- fi; \
- done
- $(STAMP) stmp-fixproto
-
-# We can't run fixproto (it's being built for a different host), but we still
-# need to install it so that the user can run it when the compiler is
-# installed.
-stmp-install-fixproto: fixproto
- $(STAMP) $@