head	1.1;
access;
symbols
	netbsd-11-0-RC4:1.1
	netbsd-11-0-RC3:1.1
	netbsd-11-0-RC2:1.1
	netbsd-11-0-RC1:1.1
	perseant-exfatfs-base-20250801:1.1
	netbsd-11:1.1.0.4
	netbsd-11-base:1.1
	perseant-exfatfs-base-20240630:1.1
	perseant-exfatfs:1.1.0.2
	perseant-exfatfs-base:1.1;
locks; strict;
comment	@# @;


1.1
date	2023.08.01.05.57.53;	author mrg;	state Exp;
branches;
next	;
commitid	wD6OCzrp5SXzV2zE;


desc
@@


1.1
log
@various updates to build native GCC 12.

- for usr.bin, build libcody and link it into cc1*plus
- move makefile code for auto-build.h and version.h (was gcov-iov.h)
  into makefile fragment to share them.  (XXX probably best to only do
  this in one place, but that's a future step.)
- many updates to handle the .c -> .cc renames
- build some x86 files with -msse2
- bump shlib versions for libgomp and libstdc++v3
- fix MKGCCCMDS=no builds
- updates for new rtl-ssa subdir
- use -std=gnu++11 for various places
- define TARGET_MACHINE and HOST_MACHINE for some places
- avoid a .BEGIN rule that writes to missing obj (ie src) sometimes

cleanups still needed:
- remove a bunch of commented -Wno* that don't seem to be needed anymore
- leave or remove various vax-specific -O0s that should no longer be
  necessary for the vax-gcc port
- some "XXXGCC12" that should be may be fixable or converted to using our
  standard ${CC_...} warnings (but may need to remain, in which case the
  XXXGCC12 marker will be removed.)

with these, and a few other changes around the tree, i've able to build
gcc12 releases for several ports that seem to work (arm64, sparc, amd64,
i386 at least so far, have run, several others have built.)
@
text
@#	$NetBSD$

# makefile fragment to build version.h

.ifndef GCC_MAKEFILE_VERSION_H
GCC_MAKEFILE_VERSION_H=1

BASEVER!=		cat ${GNUHOSTDIST}/gcc/BASE-VER
.if exists(${GNUHOSTDIST}/gcc/DEV-PHASE)
DEVPHASE!=		cat ${GNUHOSTDIST}/gcc/DEV-PHASE
.else
DEVPHASE=
.endif
.if ${DEVPHASE} == "release" || ${DEVPHASE} == ""
DATESTAMP=
.else
DATESTAMP!=		cat ${GNUHOSTDIST}/gcc/DATESTAMP
.endif

BASEVERSTR=		"\"$(BASEVER)\""
.if !empty(DEVPHASE)
DEVPHASESTR=		"\" $(DEVPHASE)\""
.else
DEVPHASESTR=		"\"\""
.endif
.if !empty(DATESTAMP)
DATESTAMPSTR=		"\" $(DATESTAMP)\""
.else
DATESTAMPSTR=		"\"\""
.endif

.include "${NETBSDSRCDIR}/tools/gcc/gcc-version.mk"

# XXX pull this out of our configs
G_BUGURL=<http://www.NetBSD.org/support/send-pr.html>
G_BUGURL_s="\"${G_BUGURL}\""
G_PKGVERSION=(${NETBSD_GCC_VERSION}) 
G_PKGVERSION_s="\"${G_PKGVERSION} \""

VER_CPPFLAGS=	-DBASEVER=$(BASEVERSTR) \
		-DDATESTAMP=$(DATESTAMPSTR) \
		-DREVISION=$(REVISION_s) \
		-DDEVPHASE=$(DEVPHASESTR) \
		-DPKGVERSION=$(G_PKGVERSION_s) \
		-DBUGURL=$(G_BUGURL_s)

CPPFLAGS.genversion.cc+=	${VER_CPPFLAGS} \
				-I${GCCARCH} \
				-I${GCC_SUBDIR}/dist/include
# XXXMRG for now, needs "nbmake-foo auto-build.h" in usr.bin/backend
#BINBACKENDOBJ!=	cd ${GCC_SUBDIR}/usr.bin/backend && ${PRINTOBJDIR}
#CPPFLAGS.genversion.cc+=	-I${BINBACKENDOBJ}
CPPFLAGS.genversion.cc+=	-I.
genversion.cc: auto-build.h
# XXXMRG for now
version.h: genversion
	${_MKTARGET_LINK}
	./genversion >${.TARGET}
genversion.lo: Makefile
genversion: genversion.lo
	${_MKTARGET_LINK}
	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBCPP} ${HOSTLIBIBERTY}

CLEANFILES+=	version.h genversion genversion.lo

.endif # GCC_MAKEFILE_VERSION_H
@
