# Copyright (C) 2002-2021 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
# GCC 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 3, or (at your option)
# any later version.
#
# GCC 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 GCC; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.

vxworks.o: $(srcdir)/config/vxworks.c
	$(COMPILE) $<
	$(POSTCOMPILE)

vxworks-c.o: $(srcdir)/config/vxworks-c.c
	$(COMPILE) $<
	$(POSTCOMPILE)

# Arrange to install our stdint.h wrapper, by copying it in the
# build-time include dir before this include dir is installed and after
# stmp-int-hdrs removes it (because it was told we don't provide it).

INSTALL_HEADERS += install-stdint.h

install-stdint.h: stmp-int-hdrs
	cp -p $(srcdir)/config/vxworks/stdint.h include/stdint.h
	chmod a+r include/stdint.h

$(INSTALL_HEADERS_DIR): install-stdint.h

# Both the kernel and RTP headers provide limits.h.  They embed VxWorks
# specificities and are dated on some configurations so we both need to
# provide our own version and make sure the system one gets exposed.

LIMITS_H_TEST = true
STMP_FIXINC = stmp-fixinc

# VxWorks system environments have been GCC based for a long time and
# we need to make sure that our files and the system ones use distinct
# macro names to protect against recursive inclusions.  We achieve
# this by modifying the GLIMITS_H fragment that goes into limits.h
# with some version indication in the inclusion-protection macro
# names.

T_GLIMITS_H = vxw-glimits.h

vxw-glimits.h: $(srcdir)/glimits.h
	ID=`echo $(BASEVER_c) | sed -e 's/\./_/g'` && \
	sed -e "s/_LIMITS_H__/_LIMITS_H__$${ID}_/" < $(srcdir)/glimits.h > $@T
	mv $@T $@
