Skip to content

Commit

Permalink
build: Implement ${HOST_CC} make variable; default cc.
Browse files Browse the repository at this point in the history
Implement the ${HOST_CC} make variable for the rest of the build.
It is the name of the compiler used on the host operating system.
A different compiler than the default, cc, can be used via:

  $ make HOST_CC=egcc

when building the system.

Programs not yet hooked into the build, such as lccom, lex, and m4,
are not updated in this commit to use ${HOST_CC}.

Note that lib/libc_aout/Makefile does not source /target.mk, and
so needs to define the ${HOST_CC} variable on its own.
${CC} is defined as ${HOST_CC} so that default compile rules will
use the specified host compiler in building the aout utilities.
  • Loading branch information
chettrick committed Jul 29, 2023
1 parent 5b54d3c commit d853304
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion games/battlestar/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ battle_strings _globals.c _dayfile.c _nightfile.c: mkstr globals.c dayfile.c nig
./mkstr battle_strings _ globals.c dayfile.c nightfile.c

mkstr: mkstr.c
cc -O mkstr.c -o $@
${HOST_CC} -O mkstr.c -o $@

${MAN}: ${MANSRC}
${MANROFF} ${MANSRC} > $@
Expand Down
2 changes: 1 addition & 1 deletion games/boggle/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bogdict: comp sfile
sed -f sfile ${TOPSRC}/share/dict/words | uniq | ./comp > bogdict

comp: comp.c
cc -O comp.c -o comp
${HOST_CC} -O comp.c -o comp

${MAN}: ${MANSRC}
${MANROFF} ${MANSRC} > $@
Expand Down
8 changes: 4 additions & 4 deletions games/fortune/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ fortune: $(OBJS)
$(SIZE) fortune.elf
$(ELF2AOUT) fortune.elf $@ && rm fortune.elf

strfile: strfile.o
$(CC) $(LDFLAGS) -o strfile strfile.o
strfile: strfile.c
${HOST_CC} -o strfile strfile.c

unstr: unstr.o
$(CC) $(LDFLAGS) -o unstr unstr.o
unstr: unstr.c
${HOST_CC} -ansi -o unstr unstr.c

fortunes.dat: #fortunes strfile
./strfile -r fortunes
Expand Down
2 changes: 1 addition & 1 deletion games/monop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ monop: $(OBJS)
$(ELF2AOUT) monop.elf $@ && rm monop.elf

initdeck: initdeck.c deck.h
$(CC) -o initdeck $(LDFLAGS) $(CFLAGS) initdeck.c
${HOST_CC} -o initdeck initdeck.c

cards.pck: #initdeck cards.inp
./initdeck
Expand Down
2 changes: 1 addition & 1 deletion games/warp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ smap.6: smp.6 sm
smap.7: smp.7 sm
./sm <smp.7 >smap.7
sm: sm.c
cc -O -Wall sm.c -o sm
${HOST_CC} -O -Wall sm.c -o sm

${MAN}: ${MANSRC}
${MANROFF} ${MANSRC} > $@
Expand Down
4 changes: 4 additions & 0 deletions lib/libc_aout/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
TOPSRC!=cd ../..; pwd

HOST_CC?= cc

CC= ${HOST_CC}

SUBDIR = startup libc libm libcurses libtermlib libwiznet libreadline libgpanel

PROG = ar_aout as_aout aout_aout ld_aout nm_aout ranlib_aout size_aout strip_aout
Expand Down
2 changes: 1 addition & 1 deletion share/zoneinfo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LOCALTIME= US/Pacific

CFLAGS= -O
LINTFLAGS= -phbaxc
CC= cc
CC= ${HOST_CC}
CFLAGS+= -Wall -idirafter ${TOPSRC}/include

TZCSRCS= zic.c scheck.c ialloc.c
Expand Down
2 changes: 2 additions & 0 deletions target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ RELEASE= 0.0
BUILD!= git rev-list HEAD --count
VERSION= ${RELEASE}-${BUILD}

HOST_CC?= cc

_HOST_OSNAME!= uname -s

GCCPREFIX!=if [ x"${MACHINE_ARCH}" = x"arm" ] ; then \
Expand Down
6 changes: 3 additions & 3 deletions usr.bin/awk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ token.h: awk.h tokenscript
install: awk
install awk ${DESTDIR}/usr/bin/

profile: awk.g.o $(FILES) mon.o
cc -p -i awk.g.o $(FILES) mon.o -lm
#profile: awk.g.o $(FILES) mon.o
# ${HOST_CC} -p -i awk.g.o ${FILES} mon.o -lm

lint:
lint -spu b.c main.c tran.c run.c lib.c parse.c -lm |\
egrep -v '^(error|free|malloc)'

proctab.c: proc.c token.h awk.h
cc -std=gnu89 -Wall -o proc proc.c
${HOST_CC} -std=gnu89 -Wall -o proc proc.c
./proc > proctab.c

clean:
Expand Down
2 changes: 1 addition & 1 deletion usr.bin/ccom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ compat.o: $(MIPDIR)/compat.c external.h
$(CC) $(CFLAGS) -c -o $@ $(MIPDIR)/compat.c

external.h external.c: ${MIPDIR}/mkext.c $(ARCHDIR)/table.c
gcc $(CFLAGS) -DMKEXT -o mkext ${MIPDIR}/mkext.c $(ARCHDIR)/table.c ${MIPDIR}/common.c
${HOST_CC} ${CFLAGS} -DMKEXT -o mkext ${MIPDIR}/mkext.c ${ARCHDIR}/table.c ${MIPDIR}/common.c
./mkext

trees.c: mip/pass2.h external.h
Expand Down
1 change: 0 additions & 1 deletion usr.bin/picoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include $(TOPSRC)/target.mk

VPATH = cstdlib platform

#CC=gcc
CFLAGS += -DUNIX_HOST -DVER='"1.0"' -DFILENAME_MAX=64 \
-DL_tmpnam=30 -DCLOCKS_PER_SEC=80000000 -DPATH_MAX=200 \
-DNO_FP -Os
Expand Down
4 changes: 4 additions & 0 deletions usr.bin/smux/linux/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
TOPSRC!=cd ../../../; pwd
include ${TOPSRC}/target.mk

CC = ${HOST_CC}
OBJS = smux.o
BIN = smux
CFLAGS = -O -Wall
Expand Down
1 change: 0 additions & 1 deletion usr.bin/unixbench/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ ID="@(#)Makefile:3.9 -- 5/15/91 19:30:15";
SHELL = /bin/sh
HZ = 20
CFLAGS += -DTIME
#CC=gcc

## For Linux 486/Pentium, GCC 2.7.x and 2.8.x
#OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math \
Expand Down
1 change: 0 additions & 1 deletion usr.sbin/cron/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ INCLUDE = -I.
OPTIM = -O
#<<lint flags of choice?>>
LINTFLAGS = -hbxa $(INCLUDE)
#CC = cc
DEFS =
INSTALL = install
#LDFLAGS = -i
Expand Down

0 comments on commit d853304

Please sign in to comment.