Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index] broken for single-suffix rules since 1.144 (2021/11/09)

I just noticed that on my recently upgraded -current machines that I
couldn't build simple programs from single source files with a
"portable" Makefile any more.

Instead the program binaries were being put into foo.o files!

It looks like rev. 1.144 of was a bit too over-zealous.

I'll send this as a PR also, but perhaps those running -current on
development machines might need a more urgent fix.

Here are my patches that include the fix, and also clean up the use of
various flags in LINK.* (remove CPPFLAGS and add LDSTATIC) and introduce
COMPILE_LINK.* macros to be used with the direct source to target binary
rules (single-suffix rules) such as ".c:" (and finally also split the
settings for debugger and optimizer flags).

The key parts are to revert the change to use ${OBJECT_TARGET} in the
single-suffix rules like ".c:" since ctfconvert(1) won't work on
(static?) linked binaries, and because of course we still need the
final output file to be the filename _without_ any suffix!

RCS file: /cvs/master/m-NetBSD/main/src/share/mk/,v
retrieving revision 1.144
diff -u -u -r1.144
---	9 Nov 2020 16:15:05 -0000	1.144
+++	21 Mar 2021 23:25:00 -0000
@@ -19,30 +19,35 @@
 AS?=		as
 COMPILE.s?=	${CC} ${AFLAGS} ${AFLAGS.${<:T}} -c
-LINK.s?=	${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${LDFLAGS}
 _ASM_TRADITIONAL_CPP=	-x assembler-with-cpp

 CC?=		cc
 .if ${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb"
 # -O2 is too -falign-* zealous for low-memory sh3 machines
-DBG?=	-Os -freorder-blocks
+OPTIM?=	-Os -freorder-blocks
 .elif ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "m68000"
 # -freorder-blocks (enabled by -O2) produces much bigger code
-DBG?=	-O2 -fno-reorder-blocks
+OPTIM?=	-O2 -fno-reorder-blocks
 .elif ${MACHINE_ARCH} == "coldfire"
+OPTIM?=	-O1
 DBG?=	-O1
-DBG?=	-O2
+OPTIM?=	-O2
+DBG?=		# nothing -- just defined
 .if ${MKDTRACE:Uno} != "no"
 DTRACE_OPTS?=	-fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-ipa-sra -fno-ipa-icf

 # C Type Format data is required for DTrace
@@ -67,12 +72,14 @@

 OBJC?=		${CC}

 CPP?=		cpp
@@ -81,14 +88,19 @@
 COMPILE.f?=	${FC} ${FFLAGS} -c

 INSTALL?=	install

+MV?=		mv
 LD?=		ld

 LEX?=		lex
@@ -107,7 +119,8 @@
 PC?=		pc

 SHELL?=		sh

@@ -121,7 +134,7 @@

 # C
 # XXX: disable for now
@@ -138,7 +151,7 @@

 # C++
 .cc .cpp .cxx .C:
+	${} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
 # XXX: disable for now
 .cc.o .cpp.o .cxx.o .C.o:
@@ -151,8 +164,9 @@

 # Fortran/Ratfor
+# XXX: disable for now
@@ -162,8 +176,9 @@
 	rm -f ${.PREFIX}.o

+# XXX: disable for now
@@ -173,8 +188,9 @@
 	rm -f ${.PREFIX}.o

+# XXX: disable for now
@@ -185,8 +201,9 @@

 # Pascal
+# XXX: disable for now
@@ -197,8 +214,9 @@

 # Assembly
+# XXX: disable for now
@@ -207,8 +225,9 @@
 	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
 	rm -f ${.PREFIX}.o
+# XXX: disable for now
@@ -220,8 +239,9 @@
 # Lex
 	${LEX.l} ${.IMPSRC}
-	${LINK.c} ${OBJECT_TARGET} lex.yy.c ${LDLIBS} -ll
+	${COMPILE_LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
+# XXX: disable for now
 	rm -f lex.yy.c
 	${LEX.l} ${.IMPSRC}
@@ -235,8 +255,9 @@
 # Yacc
 	${YACC.y} ${.IMPSRC}
+# XXX: disable for now
 	rm -f
 	${YACC.y} ${.IMPSRC}

					Greg A. Woods <>

Kelowna, BC     +1 250 762-7675           RoboHack <>
Planix, Inc. <>     Avoncote Farms <>

Attachment: pgpbvgj6_lHHp.pgp
Description: OpenPGP Digital Signature

Home | Main Index | Thread Index | Old Index