Module Name: src
Committed By: christos
Date: Sun Dec 29 18:26:19 UTC 2019
Modified Files:
src/distrib/amd64/ramdisks/common: Makefile.ramdisk
src/distrib/arc/ramdisk: Makefile
src/distrib/bebox/ramdisk: Makefile
src/distrib/cobalt/ramdisk: Makefile
src/distrib/common: Makefile.crunch
src/distrib/dreamcast/ramdisk: Makefile
src/distrib/emips/ramdisk: Makefile
src/distrib/evbppc/ramdisk: Makefile
src/distrib/ews4800mips/floppies/ramdisk: Makefile
src/distrib/hppa/ramdisk: Makefile
src/distrib/ibmnws/netboot/ramdisk: Makefile
src/distrib/landisk/ramdisk: Makefile
src/distrib/macppc/floppies/ramdisk: Makefile
src/distrib/miniroot: Makefile
src/distrib/mipsco/ramdisk: Makefile
src/distrib/newsmips/floppies/ramdisk: Makefile
src/distrib/ofppc/ramdisks/common: Makefile.ramdisk
src/distrib/pmax/ramdisk: Makefile
src/distrib/prep/floppies/ramdisk: Makefile
src/distrib/rs6000/ramdisk: Makefile
src/distrib/sandpoint/ramdisk: Makefile
src/distrib/sgimips/ramdisk: Makefile
src/distrib/sun2/miniroot: Makefile
src/distrib/sun3/miniroot: Makefile
src/rescue: Makefile
src/usr.bin/crunch/crunchgen: crunchgen.1 crunchgen.c
Log Message:
1. Remove all the special handling of variables (-d -p -P -s -S) that
were dealing with DBG (-d) LDSTATIC/NOPIE (-p), and the rest with
disabling/enabling sanitizers.
2. Use emalloc/estrdup for all the allocators instead of only some cases.
3. Add -V varspec which passes variables on the command line (as DBG
and LDSTATIC used to be passed before) instead of appending them
to the on-the-fly Makefile using -v varspec.
4. Change the distrib and rescue Makefiles to use -V instead of the removed
flags.
The motivation of this is to make variable handling consistent, less magical,
and remove the need for changing crunchgen each time we want to add disabling
an option by default.
(as proposed in tech-toolchain)
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/distrib/amd64/ramdisks/common/Makefile.ramdisk
cvs rdiff -u -r1.26 -r1.27 src/distrib/arc/ramdisk/Makefile
cvs rdiff -u -r1.3 -r1.4 src/distrib/bebox/ramdisk/Makefile
cvs rdiff -u -r1.12 -r1.13 src/distrib/cobalt/ramdisk/Makefile
cvs rdiff -u -r1.25 -r1.26 src/distrib/common/Makefile.crunch
cvs rdiff -u -r1.14 -r1.15 src/distrib/dreamcast/ramdisk/Makefile
cvs rdiff -u -r1.5 -r1.6 src/distrib/emips/ramdisk/Makefile
cvs rdiff -u -r1.23 -r1.24 src/distrib/evbppc/ramdisk/Makefile
cvs rdiff -u -r1.13 -r1.14 src/distrib/ews4800mips/floppies/ramdisk/Makefile
cvs rdiff -u -r1.6 -r1.7 src/distrib/hppa/ramdisk/Makefile
cvs rdiff -u -r1.13 -r1.14 src/distrib/ibmnws/netboot/ramdisk/Makefile
cvs rdiff -u -r1.11 -r1.12 src/distrib/landisk/ramdisk/Makefile
cvs rdiff -u -r1.50 -r1.51 src/distrib/macppc/floppies/ramdisk/Makefile
cvs rdiff -u -r1.68 -r1.69 src/distrib/miniroot/Makefile
cvs rdiff -u -r1.21 -r1.22 src/distrib/mipsco/ramdisk/Makefile
cvs rdiff -u -r1.35 -r1.36 src/distrib/newsmips/floppies/ramdisk/Makefile
cvs rdiff -u -r1.9 -r1.10 src/distrib/ofppc/ramdisks/common/Makefile.ramdisk
cvs rdiff -u -r1.52 -r1.53 src/distrib/pmax/ramdisk/Makefile
cvs rdiff -u -r1.22 -r1.23 src/distrib/prep/floppies/ramdisk/Makefile
cvs rdiff -u -r1.9 -r1.10 src/distrib/rs6000/ramdisk/Makefile
cvs rdiff -u -r1.13 -r1.14 src/distrib/sandpoint/ramdisk/Makefile
cvs rdiff -u -r1.21 -r1.22 src/distrib/sgimips/ramdisk/Makefile
cvs rdiff -u -r1.37 -r1.38 src/distrib/sun2/miniroot/Makefile
cvs rdiff -u -r1.48 -r1.49 src/distrib/sun3/miniroot/Makefile
cvs rdiff -u -r1.38 -r1.39 src/rescue/Makefile
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/crunch/crunchgen/crunchgen.1
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/crunch/crunchgen/crunchgen.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/amd64/ramdisks/common/Makefile.ramdisk
diff -u src/distrib/amd64/ramdisks/common/Makefile.ramdisk:1.14 src/distrib/amd64/ramdisks/common/Makefile.ramdisk:1.15
--- src/distrib/amd64/ramdisks/common/Makefile.ramdisk:1.14 Sat Jan 26 23:22:46 2019
+++ src/distrib/amd64/ramdisks/common/Makefile.ramdisk Sun Dec 29 13:26:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.ramdisk,v 1.14 2019/01/27 04:22:46 dholland Exp $
+# $NetBSD: Makefile.ramdisk,v 1.15 2019/12/29 18:26:16 christos Exp $
NOSANITIZER= # defined
@@ -11,7 +11,6 @@ AMD64COMMON= ${.CURDIR}/../common
WARNS= 1
DBG= -Os -fno-asynchronous-unwind-tables
-CRUNCHGEN_FLAGS= -d "${DBG}"
CRUNCHBIN= ramdiskbin
Index: src/distrib/arc/ramdisk/Makefile
diff -u src/distrib/arc/ramdisk/Makefile:1.26 src/distrib/arc/ramdisk/Makefile:1.27
--- src/distrib/arc/ramdisk/Makefile:1.26 Fri May 12 03:26:35 2017
+++ src/distrib/arc/ramdisk/Makefile Sun Dec 29 13:26:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.26 2017/05/12 07:26:35 martin Exp $
+# $NetBSD: Makefile,v 1.27 2019/12/29 18:26:16 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= -Os -mmemcpy -fno-unwind-tables
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst.en
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= le
Index: src/distrib/bebox/ramdisk/Makefile
diff -u src/distrib/bebox/ramdisk/Makefile:1.3 src/distrib/bebox/ramdisk/Makefile:1.4
--- src/distrib/bebox/ramdisk/Makefile:1.3 Tue Jan 24 13:04:01 2017
+++ src/distrib/bebox/ramdisk/Makefile Sun Dec 29 13:26:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2017/01/24 18:04:01 christos Exp $
+# $NetBSD: Makefile,v 1.4 2019/12/29 18:26:16 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= -Os
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS=-d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst.en
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/cobalt/ramdisk/Makefile
diff -u src/distrib/cobalt/ramdisk/Makefile:1.12 src/distrib/cobalt/ramdisk/Makefile:1.13
--- src/distrib/cobalt/ramdisk/Makefile:1.12 Tue Jul 18 19:12:24 2017
+++ src/distrib/cobalt/ramdisk/Makefile Sun Dec 29 13:26:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2017/07/18 23:12:24 christos Exp $
+# $NetBSD: Makefile,v 1.13 2019/12/29 18:26:16 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= -Os -mmemcpy
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst.en
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= le
Index: src/distrib/common/Makefile.crunch
diff -u src/distrib/common/Makefile.crunch:1.25 src/distrib/common/Makefile.crunch:1.26
--- src/distrib/common/Makefile.crunch:1.25 Sat Feb 1 16:05:54 2014
+++ src/distrib/common/Makefile.crunch Sun Dec 29 13:26:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.crunch,v 1.25 2014/02/01 21:05:54 matt Exp $
+# $NetBSD: Makefile.crunch,v 1.26 2019/12/29 18:26:16 christos Exp $
#
# Makefile snippet to build a crunchgen(1)ed binary from the provided lists
#
@@ -26,6 +26,17 @@
.if !defined(_MAKEFILE_CRUNCH_)
_MAKEFILE_CRUNCH_=1
+DBG?=-Os
+CRUNCHGEN_FLAGS?=\
+-V LDSTATIC=-static \
+-V DBG="${DBG}" \
+-V NOMAN= \
+-V NOLIBCSANITIZER= \
+-V NOSANITIZER= \
+-V NOPIE= \
+-V NOSSP= \
+-V NOFORT=
+
CRUNCHENV+= AWK=${TOOL_AWK:Q}
SMALLPROG?= 1
@@ -52,7 +63,7 @@ ${CRUNCHBIN}.cache: ${CRUNCHBIN}.mk
CRUNCHGEN != command -v ${TOOL_CRUNCHGEN:[-1]} || echo
${CRUNCHBIN}.mk: ${CRUNCHBIN}.conf ${CRUNCHGEN}
- ${CRUNCHENV} ${TOOL_CRUNCHGEN} -f -D ${NETBSDSRCDIR} -d ${DBG:Q} \
+ ${CRUNCHENV} ${TOOL_CRUNCHGEN} -f -D ${NETBSDSRCDIR} \
-L ${DESTDIR}/usr/lib -q ${CRUNCHGEN_FLAGS} ${CRUNCHBIN}.conf
${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP}
Index: src/distrib/dreamcast/ramdisk/Makefile
diff -u src/distrib/dreamcast/ramdisk/Makefile:1.14 src/distrib/dreamcast/ramdisk/Makefile:1.15
--- src/distrib/dreamcast/ramdisk/Makefile:1.14 Tue Jan 24 13:04:01 2017
+++ src/distrib/dreamcast/ramdisk/Makefile Sun Dec 29 13:26:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.14 2017/01/24 18:04:01 christos Exp $
+# $NetBSD: Makefile,v 1.15 2019/12/29 18:26:17 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= -Os
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list # ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= le
Index: src/distrib/emips/ramdisk/Makefile
diff -u src/distrib/emips/ramdisk/Makefile:1.5 src/distrib/emips/ramdisk/Makefile:1.6
--- src/distrib/emips/ramdisk/Makefile:1.5 Sun Mar 31 12:09:14 2019
+++ src/distrib/emips/ramdisk/Makefile Sun Dec 29 13:26:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2019/03/31 16:09:14 christos Exp $
+# $NetBSD: Makefile,v 1.6 2019/12/29 18:26:17 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -12,7 +12,6 @@ WARNS= 1
DBG= -Os -mmemcpy
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/evbppc/ramdisk/Makefile
diff -u src/distrib/evbppc/ramdisk/Makefile:1.23 src/distrib/evbppc/ramdisk/Makefile:1.24
--- src/distrib/evbppc/ramdisk/Makefile:1.23 Sun Jul 23 16:59:00 2017
+++ src/distrib/evbppc/ramdisk/Makefile Sun Dec 29 13:26:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.23 2017/07/23 20:59:00 joerg Exp $
+# $NetBSD: Makefile,v 1.24 2019/12/29 18:26:17 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= ${${ACTIVE_CC} == "clang":? -Oz -fomit-frame-pointer : -Os } -fno-unwind-tables
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS=-d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/ews4800mips/floppies/ramdisk/Makefile
diff -u src/distrib/ews4800mips/floppies/ramdisk/Makefile:1.13 src/distrib/ews4800mips/floppies/ramdisk/Makefile:1.14
--- src/distrib/ews4800mips/floppies/ramdisk/Makefile:1.13 Wed Sep 4 08:10:00 2019
+++ src/distrib/ews4800mips/floppies/ramdisk/Makefile Sun Dec 29 13:26:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.13 2019/09/04 12:10:00 martin Exp $
+# $NetBSD: Makefile,v 1.14 2019/12/29 18:26:17 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= -Os -mmemcpy -fno-unwind-tables
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst.en
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/hppa/ramdisk/Makefile
diff -u src/distrib/hppa/ramdisk/Makefile:1.6 src/distrib/hppa/ramdisk/Makefile:1.7
--- src/distrib/hppa/ramdisk/Makefile:1.6 Sun Nov 3 19:59:05 2019
+++ src/distrib/hppa/ramdisk/Makefile Sun Dec 29 13:26:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2019/11/04 00:59:05 christos Exp $
+# $NetBSD: Makefile,v 1.7 2019/12/29 18:26:17 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -10,7 +10,6 @@ MAKEFS_FLAGS+= -f 15
WARNS= 1
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/ibmnws/netboot/ramdisk/Makefile
diff -u src/distrib/ibmnws/netboot/ramdisk/Makefile:1.13 src/distrib/ibmnws/netboot/ramdisk/Makefile:1.14
--- src/distrib/ibmnws/netboot/ramdisk/Makefile:1.13 Tue Jan 24 13:04:03 2017
+++ src/distrib/ibmnws/netboot/ramdisk/Makefile Sun Dec 29 13:26:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.13 2017/01/24 18:04:03 christos Exp $
+# $NetBSD: Makefile,v 1.14 2019/12/29 18:26:17 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -10,7 +10,6 @@ MAKEFS_FLAGS+= -f 15
WARNS= 1
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/landisk/ramdisk/Makefile
diff -u src/distrib/landisk/ramdisk/Makefile:1.11 src/distrib/landisk/ramdisk/Makefile:1.12
--- src/distrib/landisk/ramdisk/Makefile:1.11 Tue Jan 24 13:04:03 2017
+++ src/distrib/landisk/ramdisk/Makefile Sun Dec 29 13:26:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2017/01/24 18:04:03 christos Exp $
+# $NetBSD: Makefile,v 1.12 2019/12/29 18:26:17 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -12,7 +12,6 @@ WARNS= 1
DBG= -Os
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= le
Index: src/distrib/macppc/floppies/ramdisk/Makefile
diff -u src/distrib/macppc/floppies/ramdisk/Makefile:1.50 src/distrib/macppc/floppies/ramdisk/Makefile:1.51
--- src/distrib/macppc/floppies/ramdisk/Makefile:1.50 Sun Jan 6 20:39:26 2019
+++ src/distrib/macppc/floppies/ramdisk/Makefile Sun Dec 29 13:26:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.50 2019/01/07 01:39:26 scole Exp $
+# $NetBSD: Makefile,v 1.51 2019/12/29 18:26:17 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -15,7 +15,6 @@ WARNS= 1
DBG= -Os
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/miniroot/Makefile
diff -u src/distrib/miniroot/Makefile:1.68 src/distrib/miniroot/Makefile:1.69
--- src/distrib/miniroot/Makefile:1.68 Sun Sep 20 15:49:09 2009
+++ src/distrib/miniroot/Makefile Sun Dec 29 13:26:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.68 2009/09/20 19:49:09 abs Exp $
+# $NetBSD: Makefile,v 1.69 2019/12/29 18:26:17 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -8,7 +8,6 @@
ARCHDIR= ${.CURDIR}/../${MACHINE}/miniroot
CRUNCHBIN= instbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${ARCHDIR}/list
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGE= miniroot.fs
Index: src/distrib/mipsco/ramdisk/Makefile
diff -u src/distrib/mipsco/ramdisk/Makefile:1.21 src/distrib/mipsco/ramdisk/Makefile:1.22
--- src/distrib/mipsco/ramdisk/Makefile:1.21 Tue Jan 24 13:04:03 2017
+++ src/distrib/mipsco/ramdisk/Makefile Sun Dec 29 13:26:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.21 2017/01/24 18:04:03 christos Exp $
+# $NetBSD: Makefile,v 1.22 2019/12/29 18:26:18 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -12,7 +12,6 @@ WARNS= 1
DBG= -Os
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/newsmips/floppies/ramdisk/Makefile
diff -u src/distrib/newsmips/floppies/ramdisk/Makefile:1.35 src/distrib/newsmips/floppies/ramdisk/Makefile:1.36
--- src/distrib/newsmips/floppies/ramdisk/Makefile:1.35 Wed Feb 6 23:33:58 2019
+++ src/distrib/newsmips/floppies/ramdisk/Makefile Sun Dec 29 13:26:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.35 2019/02/07 04:33:58 mrg Exp $
+# $NetBSD: Makefile,v 1.36 2019/12/29 18:26:18 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= -Os -mmemcpy
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/ofppc/ramdisks/common/Makefile.ramdisk
diff -u src/distrib/ofppc/ramdisks/common/Makefile.ramdisk:1.9 src/distrib/ofppc/ramdisks/common/Makefile.ramdisk:1.10
--- src/distrib/ofppc/ramdisks/common/Makefile.ramdisk:1.9 Mon Dec 24 15:11:22 2018
+++ src/distrib/ofppc/ramdisks/common/Makefile.ramdisk Sun Dec 29 13:26:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.ramdisk,v 1.9 2018/12/24 20:11:22 mrg Exp $
+# $NetBSD: Makefile.ramdisk,v 1.10 2019/12/29 18:26:18 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -9,7 +9,6 @@ OFPPCCOMMON= ${.CURDIR}/../common
WARNS= 1
DBG= -Os -fno-asynchronous-unwind-tables
-CRUNCHGEN_FLAGS= -d "${DBG}"
CRUNCHBIN= ramdiskbin
Index: src/distrib/pmax/ramdisk/Makefile
diff -u src/distrib/pmax/ramdisk/Makefile:1.52 src/distrib/pmax/ramdisk/Makefile:1.53
--- src/distrib/pmax/ramdisk/Makefile:1.52 Wed Jun 26 03:33:19 2019
+++ src/distrib/pmax/ramdisk/Makefile Sun Dec 29 13:26:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.52 2019/06/26 07:33:19 martin Exp $
+# $NetBSD: Makefile,v 1.53 2019/12/29 18:26:18 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -12,7 +12,6 @@ WARNS= 1
DBG= -Os -mmemcpy
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= le
Index: src/distrib/prep/floppies/ramdisk/Makefile
diff -u src/distrib/prep/floppies/ramdisk/Makefile:1.22 src/distrib/prep/floppies/ramdisk/Makefile:1.23
--- src/distrib/prep/floppies/ramdisk/Makefile:1.22 Tue Jan 24 13:04:04 2017
+++ src/distrib/prep/floppies/ramdisk/Makefile Sun Dec 29 13:26:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2017/01/24 18:04:04 christos Exp $
+# $NetBSD: Makefile,v 1.23 2019/12/29 18:26:18 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= -Os
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS=-d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst.en
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/rs6000/ramdisk/Makefile
diff -u src/distrib/rs6000/ramdisk/Makefile:1.9 src/distrib/rs6000/ramdisk/Makefile:1.10
--- src/distrib/rs6000/ramdisk/Makefile:1.9 Wed Feb 6 02:51:20 2019
+++ src/distrib/rs6000/ramdisk/Makefile Sun Dec 29 13:26:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.9 2019/02/06 07:51:20 mrg Exp $
+# $NetBSD: Makefile,v 1.10 2019/12/29 18:26:18 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= -Os
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list # ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/sandpoint/ramdisk/Makefile
diff -u src/distrib/sandpoint/ramdisk/Makefile:1.13 src/distrib/sandpoint/ramdisk/Makefile:1.14
--- src/distrib/sandpoint/ramdisk/Makefile:1.13 Tue Jan 24 13:04:04 2017
+++ src/distrib/sandpoint/ramdisk/Makefile Sun Dec 29 13:26:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.13 2017/01/24 18:04:04 christos Exp $
+# $NetBSD: Makefile,v 1.14 2019/12/29 18:26:18 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -11,7 +11,6 @@ WARNS= 1
DBG= -Os
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS=-d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/sgimips/ramdisk/Makefile
diff -u src/distrib/sgimips/ramdisk/Makefile:1.21 src/distrib/sgimips/ramdisk/Makefile:1.22
--- src/distrib/sgimips/ramdisk/Makefile:1.21 Wed Feb 6 23:33:58 2019
+++ src/distrib/sgimips/ramdisk/Makefile Sun Dec 29 13:26:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.21 2019/02/07 04:33:58 mrg Exp $
+# $NetBSD: Makefile,v 1.22 2019/12/29 18:26:18 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -12,7 +12,6 @@ WARNS= 1
DBG= -Os -mmemcpy
CRUNCHBIN= ramdiskbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
Index: src/distrib/sun2/miniroot/Makefile
diff -u src/distrib/sun2/miniroot/Makefile:1.37 src/distrib/sun2/miniroot/Makefile:1.38
--- src/distrib/sun2/miniroot/Makefile:1.37 Tue Dec 17 21:35:59 2019
+++ src/distrib/sun2/miniroot/Makefile Sun Dec 29 13:26:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.37 2019/12/18 02:35:59 christos Exp $
+# $NetBSD: Makefile,v 1.38 2019/12/29 18:26:18 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -15,7 +15,6 @@ WARNS= 1
DBG= -Os -fno-unwind-tables
CRUNCHBIN= instbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list
MTREECONF= ${.CURDIR}/mtree.conf
Index: src/distrib/sun3/miniroot/Makefile
diff -u src/distrib/sun3/miniroot/Makefile:1.48 src/distrib/sun3/miniroot/Makefile:1.49
--- src/distrib/sun3/miniroot/Makefile:1.48 Sat Oct 26 22:07:42 2019
+++ src/distrib/sun3/miniroot/Makefile Sun Dec 29 13:26:19 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.48 2019/10/27 02:07:42 christos Exp $
+# $NetBSD: Makefile,v 1.49 2019/12/29 18:26:19 christos Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -17,7 +17,6 @@ DBG= -Os
USE_WIDECHAR= no
CRUNCHBIN= instbin
-CRUNCHGEN_FLAGS= -d "${DBG}"
LISTS= ${.CURDIR}/list
MTREECONF= ${.CURDIR}/mtree.conf
Index: src/rescue/Makefile
diff -u src/rescue/Makefile:1.38 src/rescue/Makefile:1.39
--- src/rescue/Makefile:1.38 Wed Oct 2 05:45:10 2019
+++ src/rescue/Makefile Sun Dec 29 13:26:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.38 2019/10/02 09:45:10 maya Exp $
+# $NetBSD: Makefile,v 1.39 2019/12/29 18:26:16 christos Exp $
NOLIBCSANITIZER= # defined
NOSANITIZER= # defined
@@ -12,13 +12,17 @@ WARNS= 1
DBG+= -Os
.endif
-CRUNCHGEN_FLAGS=-d "${DBG}"
+CRUNCHGEN_FLAGS+=-V DBG="${DBG}"
.if ${MKSTATICPIE:Uno} == "yes"
-CRUNCHGEN_FLAGS+=-p
CFLAGS+=-fPIE
+CRUNCHGEN_FLAGS+=-V LDSTATIC="-static -pie"
+.else
+CRUNCHGEN_FLAGS+=-V LDSTATIC="-static" -V NOPIE=
.endif
+CRUNCHGEN_FLAGS+=-V NOLIBCSANITIZER= -V NOSANITIZER= -V NOMAN=
+
RESCUEDIR= /rescue
CRUNCHBIN= rescue
CRUNCHENV= RESCUEDIR=${RESCUEDIR}
Index: src/usr.bin/crunch/crunchgen/crunchgen.1
diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.38 src/usr.bin/crunch/crunchgen/crunchgen.1:1.39
--- src/usr.bin/crunch/crunchgen/crunchgen.1:1.38 Tue Dec 17 21:16:04 2019
+++ src/usr.bin/crunch/crunchgen/crunchgen.1 Sun Dec 29 13:26:16 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: crunchgen.1,v 1.38 2019/12/18 02:16:04 christos Exp $
+.\" $NetBSD: crunchgen.1,v 1.39 2019/12/29 18:26:16 christos Exp $
.\"
.\" Copyright (c) 1994 University of Maryland
.\" All Rights Reserved.
@@ -24,7 +24,7 @@
.\" Computer Science Department
.\" University of Maryland at College Park
.\"
-.Dd June 21, 2018
+.Dd December 23, 2019
.Dt CRUNCHGEN 1
.Os
.Sh NAME
@@ -32,14 +32,14 @@
.Nd generates build environment for a crunched binary
.Sh SYNOPSIS
.Nm
-.Op Fl FfOoPpqSs
+.Op Fl FfOoq
.Op Fl c Ar c-file-name
.Op Fl D Ar src-root
-.Op Fl d Ar build-options
.Op Fl e Ar exec-file-name
.Op Fl L Ar lib-dir
.Op Fl m Ar makefile-name
.Op Fl v Ar var-spec
+.Op Fl V Ar var-spec
.Ar conf-file
.Sh DESCRIPTION
A crunched binary is a program made up of many other programs linked
@@ -92,10 +92,6 @@ The default name is
.It Fl D Ar src-root
Assume that relative source directory specifications begin with
.Ar src-root .
-.It Fl d Ar build-options
-Set the DBG variable in the generated makefile to
-.Ar build-options .
-The default flags are -Os.
.It Fl e Ar exec-file-name
Set crunched binary executable file name to
.Ar exec-file-name .
@@ -126,19 +122,15 @@ the program objects into a single reloca
Use existing object files.
Rather than rebuilding object files via reach-over
makefiles, instead search for and use existing object files.
-.It Fl P
-Enable stack protector.
-.It Fl p
-Produce static pie (position independent executables).
.It Fl q
Quiet operation.
Status messages are suppressed.
-.It Fl S
-Enable sanitization with a sanitizer in libc.
-.It Fl s
-Enable sanitization.
.It Fl v Ar varspec
-Append a variable specification to the on-the fly generated Makefile.
+Append a variable specification to the on-the fly generated Makefiles
+for the individual programs.
+.It Fl V ar varspec
+Set the variable in the top level Makefile, and pass it in the command
+line of all sub-makes, so that it cannot be overwriten.
.El
.Sh CRUNCHGEN CONFIGURATION FILE COMMANDS
.Nm
Index: src/usr.bin/crunch/crunchgen/crunchgen.c
diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.93 src/usr.bin/crunch/crunchgen/crunchgen.c:1.94
--- src/usr.bin/crunch/crunchgen/crunchgen.c:1.93 Tue Dec 17 21:16:04 2019
+++ src/usr.bin/crunch/crunchgen/crunchgen.c Sun Dec 29 13:26:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: crunchgen.c,v 1.93 2019/12/18 02:16:04 christos Exp $ */
+/* $NetBSD: crunchgen.c,v 1.94 2019/12/29 18:26:16 christos Exp $ */
/*
* Copyright (c) 1994 University of Maryland
* All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: crunchgen.c,v 1.93 2019/12/18 02:16:04 christos Exp $");
+__RCSID("$NetBSD: crunchgen.c,v 1.94 2019/12/29 18:26:16 christos Exp $");
#endif
#include <stdlib.h>
@@ -55,7 +55,7 @@ __RCSID("$NetBSD: crunchgen.c,v 1.93 201
#include <sys/param.h>
#include <sys/utsname.h>
-#define CRUNCH_VERSION "20180508"
+#define CRUNCH_VERSION "20191223"
#define MAXLINELEN 16384
#define MAXFIELDS 2048
@@ -80,6 +80,12 @@ typedef struct prog {
int goterror;
} prog_t;
+typedef struct var {
+ struct var *next;
+ char *name;
+ const char *value;
+ size_t len;
+} var_t;
/* global state */
@@ -87,6 +93,8 @@ static strlst_t *srcdirs = NULL;
static strlst_t *libs = NULL;
static strlst_t *vars = NULL;
static prog_t *progs = NULL;
+static var_t *mvars = NULL;
+static var_t *evars = NULL;
static char line[MAXLINELEN];
@@ -96,15 +104,13 @@ static char cachename[MAXPATHLEN], curfi
static char curdir[MAXPATHLEN];
static char topdir[MAXPATHLEN];
static char libdir[MAXPATHLEN] = "/usr/lib";
-static char dbg[MAXPATHLEN] = "-Os";
static int linenum = -1;
static int goterror = 0;
static const char *pname = "crunchgen";
/* options */
-static int verbose, readcache, useobjs, oneobj, pie, libcsanitizer, sanitizer;
-static int ssp, fortify;
+static int verbose, readcache, useobjs, oneobj;
static int reading_cache;
static char *machine;
@@ -115,10 +121,10 @@ static char *makeflags;
/* general library routines */
static void status(const char *str);
-__dead static void out_of_memory(void);
static void add_string(strlst_t **listp, char *str);
static int is_dir(const char *pathname);
static int is_nonempty_file(const char *pathname);
+static void addvar(const char *cstr);
/* helper routines for main() */
@@ -154,32 +160,26 @@ main(int argc, char **argv)
readcache = 1;
useobjs = 0;
oneobj = 1;
- pie = 0;
*outmkname = *outcfname = *execfname = '\0';
if (argc > 0)
pname = argv[0];
- while ((optc = getopt(argc, argv, "m:c:d:e:FfopPqsD:L:Ov:")) != -1) {
+ while ((optc = getopt(argc, argv, "m:c:e:foqsD:L:OV:v:")) != -1) {
switch(optc) {
case 'f': readcache = 0; break;
- case 'F': fortify = 1; break;
- case 'p': pie = 1; break;
- case 'P': ssp = 1; break;
case 'q': verbose = 0; break;
case 'O': oneobj = 0; break;
case 'o': useobjs = 1, oneobj = 0; break;
- case 's': sanitizer = 1; break;
- case 'S': libcsanitizer = 1; break;
case 'm': (void)estrlcpy(outmkname, optarg, sizeof(outmkname)); break;
case 'c': (void)estrlcpy(outcfname, optarg, sizeof(outcfname)); break;
case 'e': (void)estrlcpy(execfname, optarg, sizeof(execfname)); break;
- case 'd': (void)estrlcpy(dbg, optarg, sizeof(dbg)); break;
case 'D': (void)estrlcpy(topdir, optarg, sizeof(topdir)); break;
case 'L': (void)estrlcpy(libdir, optarg, sizeof(libdir)); break;
case 'v': add_string(&vars, optarg); break;
+ case 'V': addvar(optarg); break;
case '?':
default: usage();
@@ -399,11 +399,8 @@ add_prog(char *progname)
if (!strcmp(p2->name, progname))
return;
- p2 = malloc(sizeof(prog_t));
- if (p2)
- p2->name = strdup(progname);
- if (!p2 || !p2->name)
- out_of_memory();
+ p2 = emalloc(sizeof(*p2));
+ p2->name = estrdup(progname);
p2->next = NULL;
if (p1 == NULL)
@@ -464,8 +461,7 @@ add_special(int argc, char **argv)
if (!strcmp(argv[2], "ident")) {
if (argc != 4)
goto argcount;
- if ((p->ident = strdup(argv[3])) == NULL)
- out_of_memory();
+ p->ident = estrdup(argv[3]);
return;
}
@@ -473,8 +469,7 @@ add_special(int argc, char **argv)
if (argc != 4)
goto argcount;
if (argv[3][0] == '/') {
- if ((p->srcdir = strdup(argv[3])) == NULL)
- out_of_memory();
+ p->srcdir = estrdup(argv[3]);
} else {
char tmppath[MAXPATHLEN];
if (topdir[0] == '\0')
@@ -483,8 +478,7 @@ add_special(int argc, char **argv)
(void)estrlcpy(tmppath, topdir, sizeof(tmppath));
(void)estrlcat(tmppath, "/", sizeof(tmppath));
(void)estrlcat(tmppath, argv[3], sizeof(tmppath));
- if ((p->srcdir = strdup(tmppath)) == NULL)
- out_of_memory();
+ p->srcdir = estrdup(tmppath);
}
return;
}
@@ -492,8 +486,7 @@ add_special(int argc, char **argv)
if (!strcmp(argv[2], "objdir")) {
if (argc != 4)
goto argcount;
- if ((p->objdir = strdup(argv[3])) == NULL)
- out_of_memory();
+ p->objdir = estrdup(argv[3]);
return;
}
@@ -603,8 +596,7 @@ fillin_program(prog_t *p)
(void)snprintf(path, sizeof(path), "%s/%s", srcparent, p->name);
if (is_dir(path)) {
if (path[0] == '/') {
- if ((p->srcdir = strdup(path)) == NULL)
- out_of_memory();
+ p->srcdir = estrdup(path);
} else {
char tmppath[MAXPATHLEN];
if (topdir[0] == '\0')
@@ -613,8 +605,7 @@ fillin_program(prog_t *p)
(void)estrlcpy(tmppath, topdir, sizeof(tmppath));
(void)estrlcat(tmppath, "/", sizeof(tmppath));
(void)estrlcat(tmppath, path, sizeof(tmppath));
- if ((p->srcdir = strdup(tmppath)) == NULL)
- out_of_memory();
+ p->srcdir = estrdup(tmppath);
}
}
}
@@ -805,13 +796,28 @@ gen_specials_cache(void)
fclose(cachef);
}
-
static void
-addno(char *str, size_t len, const char *stem)
+addvar(const char *cstr)
{
- char buf[128];
- snprintf(buf, sizeof(buf), "NO%s=\n", stem);
- strlcat(str, buf, len);
+ char *str = estrdup(cstr), *p;
+ var_t *v = emalloc(sizeof(*v));
+
+ if ((p = strchr(str, '=')) == NULL) {
+ v->value = "";
+ } else {
+ *p++ = '\0';
+ v->value = p;
+ }
+ v->name = str;
+ // "%s=${%s:Q} "
+ v->len = 2 * strlen(v->name) + 7;
+ v->next = NULL;
+ if (mvars == NULL) {
+ mvars = evars = v;
+ } else {
+ evars->next = v;
+ evars = v;
+ }
}
@@ -819,24 +825,10 @@ static void
gen_output_makefile(void)
{
prog_t *p;
+ var_t *v;
FILE *outmk;
- char noes[1024], *ptr;
-
- noes[0] = '\0';
-
- if (!pie)
- addno(noes, sizeof(noes), "PIE");
- if (!ssp)
- addno(noes, sizeof(noes), "SSP");
- if (!fortify)
- addno(noes, sizeof(noes), "FORT");
- if (!libcsanitizer)
- addno(noes, sizeof(noes), "LIBCSANITIZER");
- if (!sanitizer)
- addno(noes, sizeof(noes), "SANITIZER");
-
- addno(noes, sizeof(noes), "MAN");
-
+ size_t len;
+ char *linevars, *ptr;
(void)snprintf(line, sizeof(line), "generating %s", outmkname);
status(line);
@@ -850,14 +842,24 @@ gen_output_makefile(void)
fprintf(outmk, "# %s - generated from %s by crunchgen %s\n\n",
outmkname, infilename, CRUNCH_VERSION);
- fprintf(outmk, "%s\n", noes);
- while ((ptr = strchr(noes, '\n')) != NULL)
- *ptr = ' ';
-
top_makefile_rules(outmk);
+
+ len = 0;
+ for (v = mvars; v != NULL; v = v->next) {
+ len += v->len;
+ }
+
+ linevars = emalloc(len + 1);
+
+ ptr = linevars;
+ for (v = mvars; v != NULL; v = v->next) {
+ int rl = snprintf(ptr, v->len + 1, "%s=${%s:Q} ", v->name, v->name);
+ ptr += rl;
+ }
+
for (p = progs; p != NULL; p = p->next)
- prog_makefile_rules(outmk, p, noes);
+ prog_makefile_rules(outmk, p, linevars);
fprintf(outmk, "\n.include <bsd.prog.mk>\n");
fprintf(outmk, "\n# ========\n");
@@ -956,8 +958,11 @@ static void
top_makefile_rules(FILE *outmk)
{
prog_t *p;
+ var_t *v;
- fprintf(outmk, "DBG=%s\n", dbg);
+ for (v = mvars; v != NULL; v = v->next) {
+ fprintf(outmk, "%s=%s\n", v->name, v->value);
+ }
fprintf(outmk, "MAKE?=make\n");
#ifdef NEW_TOOLCHAIN
fprintf(outmk, "OBJCOPY?=objcopy\n");
@@ -984,7 +989,6 @@ top_makefile_rules(FILE *outmk)
fprintf(outmk, " %s_make", p->ident);
fprintf(outmk, "\n\n");
- fprintf(outmk, "LDSTATIC=-static%s\n\n", pie ? " -pie" : "");
fprintf(outmk, "PROG=%s\n\n", execfname);
fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .note.netbsd.pax -R .ident -R .comment -R .copyright\n\n");
@@ -1018,7 +1022,7 @@ bottom_makefile_rules(FILE *outmk)
static void
-prog_makefile_rules(FILE *outmk, prog_t *p, const char *noes)
+prog_makefile_rules(FILE *outmk, prog_t *p, const char *linevars)
{
strlst_t *lst;
@@ -1048,8 +1052,8 @@ prog_makefile_rules(FILE *outmk, prog_t
fprintf(outmk, "%s\\n", lst->str);
fprintf(outmk, "'\\\n");
#define MAKECMD \
- "\t| ${MAKE} -f- CRUNCHEDPROG=1 %sDBG=${DBG:Q} LDSTATIC=${LDSTATIC:Q} "
- fprintf(outmk, MAKECMD "depend", noes);
+ "\t| ${MAKE} -f- CRUNCHEDPROG=1 %s"
+ fprintf(outmk, MAKECMD "depend", linevars);
fprintf(outmk, " )\n");
fprintf(outmk, "\t( cd %s; printf '.PATH: ${%s_SRCDIR}\\n"
".CURDIR:= ${%s_SRCDIR}\\n"
@@ -1058,7 +1062,7 @@ prog_makefile_rules(FILE *outmk, prog_t
for (lst = vars; lst != NULL; lst = lst->next)
fprintf(outmk, "%s\\n", lst->str);
fprintf(outmk, "'\\\n");
- fprintf(outmk, MAKECMD, noes);
+ fprintf(outmk, MAKECMD, linevars);
if (p->objs)
fprintf(outmk, "${%s_OBJS} ) \n\n", p->ident);
else
@@ -1141,14 +1145,6 @@ status(const char *str)
static void
-out_of_memory(void)
-{
- fprintf(stderr, "%s: %d: out of memory, stopping.\n", infilename, linenum);
- exit(1);
-}
-
-
-static void
add_string(strlst_t **listp, char *str)
{
strlst_t *p1, *p2;
@@ -1159,11 +1155,8 @@ add_string(strlst_t **listp, char *str)
if (!strcmp(p2->str, str))
return;
- p2 = malloc(sizeof(strlst_t));
- if (p2)
- p2->str = strdup(str);
- if (!p2 || !p2->str)
- out_of_memory();
+ p2 = emalloc(sizeof(*p2));
+ p2->str = estrdup(str);
p2->next = NULL;
if (p1 == NULL)