I think this is correct support for cross-compilation, and what you
are trying to do is less important.

Frederic Cambus <f...@statdns.com> wrote:

> Hi tech@,
> 
> When trying the GCC 11 static analyzer on games, I noticed that some of
> them (adventure, boggle, fortune, hack, monop, phantasia) have hardcoded
> calls to ${HOSTCC}. They would obviously not compile when passed the GCC's
> "-fanalyzer" flag through CFLAGS as it is not recognized by Clang.
> 
> Most of those calls were added in 1996 by the following commit:
> 
> https://github.com/openbsd/src/commit/da34e3c3d40263be91967714eaa1a2c4390ea117
> 
> And the remaining ones in early 1997:
> 
> https://github.com/openbsd/src/commit/bdcd13e0503c5cfa23706bc22449229ca71dddaf
> https://github.com/openbsd/src/commit/06f1ba87d9fbb136e239d3f8fa0b8a7c8c825687
> 
> Unless I'm mistaken, I don't see any reason why we need to keep them.
> 
> The following diff removes them.
> 
> Comments? OK?
> 
> Index: games/adventure/Makefile
> ===================================================================
> RCS file: /cvs/src/games/adventure/Makefile,v
> retrieving revision 1.5
> diff -u -p -r1.5 Makefile
> --- games/adventure/Makefile  23 May 2002 18:42:59 -0000      1.5
> +++ games/adventure/Makefile  12 Oct 2023 07:39:02 -0000
> @@ -9,6 +9,6 @@ data.c: glorkz setup
>       ./setup ${.CURDIR}/glorkz > data.c
>  
>  setup: setup.c hdr.h
> -     ${HOSTCC} -o setup ${.CURDIR}/setup.c
> +     ${CC} -o setup ${.CURDIR}/setup.c
>  
>  .include <bsd.prog.mk>
> Index: games/boggle/mkdict/Makefile
> ===================================================================
> RCS file: /cvs/src/games/boggle/mkdict/Makefile,v
> retrieving revision 1.4
> diff -u -p -r1.4 Makefile
> --- games/boggle/mkdict/Makefile      7 Jan 2016 16:00:31 -0000       1.4
> +++ games/boggle/mkdict/Makefile      12 Oct 2023 07:39:02 -0000
> @@ -5,7 +5,6 @@
>  PROG=        mkdict
>  CFLAGS+=-I${.CURDIR}/../boggle
>  NOMAN=noman
> -CC=${HOSTCC}
>  
>  install:
>  
> Index: games/boggle/mkindex/Makefile
> ===================================================================
> RCS file: /cvs/src/games/boggle/mkindex/Makefile,v
> retrieving revision 1.4
> diff -u -p -r1.4 Makefile
> --- games/boggle/mkindex/Makefile     7 Jan 2016 16:00:31 -0000       1.4
> +++ games/boggle/mkindex/Makefile     12 Oct 2023 07:39:02 -0000
> @@ -5,7 +5,6 @@
>  PROG=        mkindex
>  CFLAGS+=-I${.CURDIR}/../boggle
>  NOMAN=noman
> -CC=${HOSTCC}
>  
>  install:
>  
> Index: games/fortune/strfile/Makefile
> ===================================================================
> RCS file: /cvs/src/games/fortune/strfile/Makefile,v
> retrieving revision 1.4
> diff -u -p -r1.4 Makefile
> --- games/fortune/strfile/Makefile    9 Feb 1997 13:52:40 -0000       1.4
> +++ games/fortune/strfile/Makefile    12 Oct 2023 07:39:02 -0000
> @@ -4,6 +4,5 @@
>  
>  PROG=        strfile
>  MAN= strfile.8
> -CC=  ${HOSTCC}
>  
>  .include <bsd.prog.mk>
> Index: games/hack/Makefile
> ===================================================================
> RCS file: /cvs/src/games/hack/Makefile,v
> retrieving revision 1.17
> diff -u -p -r1.17 Makefile
> --- games/hack/Makefile       5 Apr 2019 09:02:27 -0000       1.17
> +++ games/hack/Makefile       12 Oct 2023 07:39:02 -0000
> @@ -24,7 +24,7 @@ hack.onames.h: makedefs def.objects.h
>       ${.OBJDIR}/makedefs ${.CURDIR}/def.objects.h > hack.onames.h
>  
>  makedefs: makedefs.c
> -     ${HOSTCC} ${CFLAGS} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} 
> ${.CURDIR}/${.PREFIX}.c ${LDADD}
> +     ${CC} ${CFLAGS} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} 
> ${.CURDIR}/${.PREFIX}.c ${LDADD}
>  
>  beforeinstall: 
>       ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 
> ${.CURDIR}/help \
> Index: games/monop/Makefile
> ===================================================================
> RCS file: /cvs/src/games/monop/Makefile,v
> retrieving revision 1.7
> diff -u -p -r1.7 Makefile
> --- games/monop/Makefile      23 May 2002 18:43:00 -0000      1.7
> +++ games/monop/Makefile      12 Oct 2023 07:39:02 -0000
> @@ -12,7 +12,7 @@ cards.pck: initdeck
>       ${.OBJDIR}/initdeck ${.CURDIR}/cards.inp
>  
>  initdeck: initdeck.c
> -     ${HOSTCC} ${CFLAGS} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} 
> ${.CURDIR}/initdeck.c ${LDADD}
> +     ${CC} ${CFLAGS} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} 
> ${.CURDIR}/initdeck.c ${LDADD}
>  
>  beforeinstall:
>       ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 cards.pck \
> Index: games/phantasia/Makefile
> ===================================================================
> RCS file: /cvs/src/games/phantasia/Makefile,v
> retrieving revision 1.19
> diff -u -p -r1.19 Makefile
> --- games/phantasia/Makefile  11 Jul 2022 03:11:49 -0000      1.19
> +++ games/phantasia/Makefile  12 Oct 2023 07:39:02 -0000
> @@ -11,13 +11,13 @@ CLEANFILES+=map setup setup.o phantglobs
>  all: setup phantasia
>  
>  setup.o: setup.c
> -     ${HOSTCC} -c ${CFLAGS} -o ${.TARGET} ${.CURDIR}/setup.c
> +     ${CC} -c ${CFLAGS} -o ${.TARGET} ${.CURDIR}/setup.c
>  
>  phantglobs.o.bld: phantglobs.c
> -     ${HOSTCC} -c ${CFLAGS} -o ${.TARGET} ${.CURDIR}/phantglobs.c
> +     ${CC} -c ${CFLAGS} -o ${.TARGET} ${.CURDIR}/phantglobs.c
>  
>  setup: phantglobs.o.bld setup.o monsters.asc ${DPADD} 
> -     ${HOSTCC} ${CFLAGS} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} \
> +     ${CC} ${CFLAGS} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} \
>                 phantglobs.o.bld setup.o ${LDADD}
>  
>  beforeinstall: 
> @@ -28,7 +28,7 @@ beforeinstall: 
>  # PLOTDEVICE is used for plotting the map.  Change as appropriate.
>  
>  map: map.c
> -     ${HOSTCC} -O ${.CURDIR}/map.c -lplot -o ${.TARGET}
> +     ${CC} -O ${.CURDIR}/map.c -lplot -o ${.TARGET}
>       ./map | plot > /dev/tty
>  
>  .include <bsd.prog.mk>
> 

Reply via email to