Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Aug 2008 01:15:13 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        arch@freebsd.org, ru@freebsd.org
Subject:   Code review: using ${.TARGET} instead of opt_*.h
Message-ID:  <20080825.011513.-432836673.imp@bsdimp.com>

next in thread | raw e-mail | index | archive | help
----Next_Part(Mon_Aug_25_01_15_13_2008_547)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

[[ resent with attachment]]

I was cleaning out my tree, and noticed that I took a stab at solving
the problem opt_*.h being explicitly named in rules rather than
${.TARGET} when building modules.

Comments?

Warner

----Next_Part(Mon_Aug_25_01_15_13_2008_547)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="make-target.diff"

Index: wlan_wep/Makefile
===================================================================
--- wlan_wep/Makefile	(revision 182150)
+++ wlan_wep/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
+	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: wlan_amrr/Makefile
===================================================================
--- wlan_amrr/Makefile	(revision 182150)
+++ wlan_amrr/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
+	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: digi/digi/Makefile
===================================================================
--- digi/digi/Makefile	(revision 182150)
+++ digi/digi/Makefile	(working copy)
@@ -9,8 +9,8 @@
 
 .if !defined(KERNBUILDDIR)
 opt_compat.h:
-	echo "#define COMPAT_43 1" > opt_compat.h
-	echo "#define COMPAT_FREEBSD6 1" >> opt_compat.h
+	echo "#define COMPAT_43 1" > ${.TARGET}
+	echo "#define COMPAT_FREEBSD6 1" >> ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: wlan_acl/Makefile
===================================================================
--- wlan_acl/Makefile	(revision 182150)
+++ wlan_acl/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
+	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: netgraph/sync_ar/Makefile
===================================================================
--- netgraph/sync_ar/Makefile	(revision 182150)
+++ netgraph/sync_ar/Makefile	(working copy)
@@ -1,13 +1,13 @@
 # $FreeBSD$
- 
+
 .PATH:  ${.CURDIR}/../../../dev/ar
 KMOD    = ng_sync_ar
 SRCS    = if_ar.c if_ar_isa.c if_ar_pci.c
 SRCS    += device_if.h bus_if.h pci_if.h isa_if.h opt_netgraph.h
-  
+
 .if !defined(KERNBUILDDIR)
 opt_netgraph.h:
-	echo "#define NETGRAPH" > opt_netgraph.h
+	echo "#define NETGRAPH" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: netgraph/sync_sr/Makefile
===================================================================
--- netgraph/sync_sr/Makefile	(revision 182150)
+++ netgraph/sync_sr/Makefile	(working copy)
@@ -1,13 +1,13 @@
 # $FreeBSD$
- 
+
 .PATH:  ${.CURDIR}/../../../dev/sr
 KMOD    = ng_sync_sr
 SRCS    = if_sr.c if_sr_isa.c if_sr_pci.c
 SRCS    += device_if.h bus_if.h pci_if.h isa_if.h opt_netgraph.h
-  
+
 .if !defined(KERNBUILDDIR)
 opt_netgraph.h:
-	echo "#define NETGRAPH" > opt_netgraph.h
+	echo "#define NETGRAPH" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: aha/Makefile
===================================================================
--- aha/Makefile	(revision 182150)
+++ aha/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_scsi.h:
-	echo "#define SCSI_DELAY 15000" > opt_scsi.h
+	echo "#define SCSI_DELAY 15000" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: ahb/Makefile
===================================================================
--- ahb/Makefile	(revision 182150)
+++ ahb/Makefile	(working copy)
@@ -3,12 +3,11 @@
 .PATH: ${.CURDIR}/../../dev/ahb
 
 KMOD=	ahb
-SRCS=	ahb.c opt_cam.h device_if.h bus_if.h \
-	eisa_if.h opt_scsi.h
+SRCS=	ahb.c opt_cam.h device_if.h bus_if.h eisa_if.h opt_scsi.h
 
 .if !defined(KERNBUILDDIR)
 opt_scsi.h:
-	echo "#define SCSI_DELAY 15000" > opt_scsi.h
+	echo "#define SCSI_DELAY 15000" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: svr4/Makefile
===================================================================
--- svr4/Makefile	(revision 182150)
+++ svr4/Makefile	(working copy)
@@ -26,11 +26,11 @@
 
 .if !defined(KERNBUILDDIR)
 opt_compat.h:
-	echo "#define COMPAT_43 1" > opt_compat.h
+	echo "#define COMPAT_43 1" > ${.TARGET}
 
 .if defined(DEBUG)
 opt_svr4.h:
-	echo "#define DEBUG_SVR4 1" > opt_svr4.h
+	echo "#define DEBUG_SVR4 1" > ${.TARGET}
 .endif
 .endif
 
Index: patm/Makefile
===================================================================
--- patm/Makefile	(revision 182150)
+++ patm/Makefile	(working copy)
@@ -14,10 +14,10 @@
 
 .if !defined(KERNBUILDDIR)
 opt_inet.h:
-	echo "#define INET 1" > opt_inet.h
+	echo "#define INET 1" > ${.TARGET}
 
 opt_natm.h:
-	echo "#define NATM 1" > opt_natm.h
+	echo "#define NATM 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: trm/Makefile
===================================================================
--- trm/Makefile	(revision 182150)
+++ trm/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_scsi.h:
-	echo "#define SCSI_DELAY 15000" > opt_scsi.h
+	echo "#define SCSI_DELAY 15000" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: wlan_rssadapt/Makefile
===================================================================
--- wlan_rssadapt/Makefile	(revision 182150)
+++ wlan_rssadapt/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
+	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: fatm/Makefile
===================================================================
--- fatm/Makefile	(revision 182150)
+++ fatm/Makefile	(working copy)
@@ -11,10 +11,10 @@
 
 .if !defined(KERNBUILDDIR)
 opt_inet.h:
-	echo "#define INET 1" > opt_inet.h
+	echo "#define INET 1" > ${.TARGET}
 
 opt_natm.h:
-	echo "#define NATM 1" > opt_natm.h
+	echo "#define NATM 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: ubsec/Makefile
===================================================================
--- ubsec/Makefile	(revision 182150)
+++ ubsec/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_ubsec.h:
-	echo "#define UBSEC_DEBUG 1" > opt_ubsec.h
+	echo "#define UBSEC_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: ath_rate_onoe/Makefile
===================================================================
--- ath_rate_onoe/Makefile	(revision 182150)
+++ ath_rate_onoe/Makefile	(working copy)
@@ -61,8 +61,8 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
-#	echo > opt_wlan.h
+	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
+#	echo > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: pf/Makefile
===================================================================
--- pf/Makefile	(revision 182150)
+++ pf/Makefile	(working copy)
@@ -15,20 +15,20 @@
 
 .if !defined(KERNBUILDDIR)
 opt_inet.h:
-	echo "#define INET 1" > opt_inet.h
+	echo "#define INET 1" > ${.TARGET}
 
 .if ${MK_INET6_SUPPORT} != "no"
 opt_inet6.h:
-	echo "#define INET6 1" > opt_inet6.h
+	echo "#define INET6 1" > ${.TARGET}
 .endif
 
 opt_bpf.h:
-	echo "#define DEV_BPF 1" > opt_bpf.h
+	echo "#define DEV_BPF 1" > ${.TARGET}
 
 # pflog can be loaded as a module, have the additional checks turned on
 opt_pf.h:
-	echo "#define DEV_PF 1" > opt_pf.h
-	echo "#define DEF_PFLOG 1" >> opt_pf.h
+	echo "#define DEV_PF 1" > ${.TARGET}
+	echo "#define DEF_PFLOG 1" >> ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: sppp/Makefile
===================================================================
--- sppp/Makefile	(revision 182150)
+++ sppp/Makefile	(working copy)
@@ -17,13 +17,13 @@
 
 .if !defined(KERNBUILDDIR)
 opt_inet.h:
-	echo "#define INET 1" > opt_inet.h
+	echo "#define INET 1" > ${.TARGET}
 
 opt_inet6.h:
-	echo "#define INET6 1" > opt_inet6.h
+	echo "#define INET6 1" > ${.TARGET}
 
 opt_ipx.h:
-	echo "#define IPX 1" > opt_ipx.h
+	echo "#define IPX 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: an/Makefile
===================================================================
--- an/Makefile	(revision 182150)
+++ an/Makefile	(working copy)
@@ -9,7 +9,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_inet.h:
-	echo "#define INET 1" > opt_inet.h
+	echo "#define INET 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: ar/Makefile
===================================================================
--- ar/Makefile	(revision 182150)
+++ ar/Makefile	(working copy)
@@ -10,7 +10,7 @@
 
 .if ${NETGRAPH} != 0
 opt_netgraph.h:
-	echo "#define NETGRAPH ${NETGRAPH}" > opt_netgraph.h
+	echo "#define NETGRAPH ${NETGRAPH}" > ${.TARGET}
 .endif
 .endif
 
Index: wlan_xauth/Makefile
===================================================================
--- wlan_xauth/Makefile	(revision 182150)
+++ wlan_xauth/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
+	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: ath_rate_sample/Makefile
===================================================================
--- ath_rate_sample/Makefile	(revision 182150)
+++ ath_rate_sample/Makefile	(working copy)
@@ -61,8 +61,8 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-#	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
-	echo > opt_wlan.h
+#	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
+	echo > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: rp/Makefile
===================================================================
--- rp/Makefile	(revision 182150)
+++ rp/Makefile	(working copy)
@@ -7,7 +7,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_compat.h:
-	echo "#define COMPAT_43 1" > opt_compat.h
+	echo "#define COMPAT_43 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: ce/Makefile
===================================================================
--- ce/Makefile	(revision 182150)
+++ ce/Makefile	(working copy)
@@ -16,12 +16,12 @@
 
 .if ${NETGRAPH} != 0
 opt_netgraph.h:
-	echo "#define NETGRAPH ${NETGRAPH}" > opt_netgraph.h
+	echo "#define NETGRAPH ${NETGRAPH}" > ${.TARGET}
 .endif
 
 .if ${NG_CRONYX} != 0
 opt_ng_cronyx.h:
-	echo "#define NETGRAPH_CRONYX 1" > opt_ng_cronyx.h
+	echo "#define NETGRAPH_CRONYX 1" > ${.TARGET}
 .endif
 .endif
 
Index: cp/Makefile
===================================================================
--- cp/Makefile	(revision 182150)
+++ cp/Makefile	(working copy)
@@ -16,12 +16,12 @@
 
 .if ${NETGRAPH} != 0
 opt_netgraph.h:
-	echo "#define NETGRAPH ${NETGRAPH}" > opt_netgraph.h
+	echo "#define NETGRAPH ${NETGRAPH}" > ${.TARGET}
 .endif
 
 .if ${NG_CRONYX} != 0
 opt_ng_cronyx.h:
-	echo "#define NETGRAPH_CRONYX 1" > opt_ng_cronyx.h
+	echo "#define NETGRAPH_CRONYX 1" > ${.TARGET}
 .endif
 .endif
 
Index: pflog/Makefile
===================================================================
--- pflog/Makefile	(revision 182150)
+++ pflog/Makefile	(working copy)
@@ -12,15 +12,15 @@
 
 .if !defined(KERNBUILDDIR)
 opt_inet.h:
-	echo "#define INET 1" > opt_inet.h
+	echo "#define INET 1" > ${.TARGET}
 
 .if ${MK_INET6_SUPPORT} != "no"
 opt_inet6.h:
-	echo "#define INET6 1" > opt_inet6.h
+	echo "#define INET6 1" > ${.TARGET}
 .endif
 
 opt_bpf.h:
-	echo "#define DEV_BPF 1" > opt_bpf.h
+	echo "#define DEV_BPF 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: cx/Makefile
===================================================================
--- cx/Makefile	(revision 182150)
+++ cx/Makefile	(working copy)
@@ -15,12 +15,12 @@
 
 .if ${NETGRAPH} != 0
 opt_netgraph.h:
-	echo "#define NETGRAPH $(NETGRAPH)" > opt_netgraph.h
+	echo "#define NETGRAPH $(NETGRAPH)" > ${.TARGET}
 .endif
 
 .if ${NG_CRONYX} != 0
 opt_ng_cronyx.h:
-	echo "#define NETGRAPH_CRONYX 1" > opt_ng_cronyx.h
+	echo "#define NETGRAPH_CRONYX 1" > ${.TARGET}
 .endif
 .endif	
 
Index: sr/Makefile
===================================================================
--- sr/Makefile	(revision 182150)
+++ sr/Makefile	(working copy)
@@ -10,7 +10,7 @@
 
 .if ${NETGRAPH} != 0
 opt_netgraph.h:
-	echo "#define NETGRAPH ${NETGRAPH}" > opt_netgraph.h
+	echo "#define NETGRAPH ${NETGRAPH}" > ${.TARGET}
 .endif
 .endif
 
Index: hatm/Makefile
===================================================================
--- hatm/Makefile	(revision 182150)
+++ hatm/Makefile	(working copy)
@@ -13,10 +13,10 @@
 
 .if !defined(KERNBUILDDIR)
 opt_inet.h:
-	echo "#define INET 1" > opt_inet.h
+	echo "#define INET 1" > ${.TARGET}
 
 opt_natm.h:
-	echo "#define NATM 1" > opt_natm.h
+	echo "#define NATM 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: wlan/Makefile
===================================================================
--- wlan/Makefile	(revision 182150)
+++ wlan/Makefile	(working copy)
@@ -14,14 +14,14 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
-	echo "#define IEEE80211_AMDPU_AGE 1" >> opt_wlan.h
+	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
+	echo "#define IEEE80211_AMDPU_AGE 1" >> ${.TARGET}
 
 opt_inet.h:
-	echo "#define INET 1" > opt_inet.h
+	echo "#define INET 1" > ${.TARGET}
 
 opt_ipx.h:
-	echo "#define IPX 1" > opt_ipx.h
+	echo "#define IPX 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: ath_rate_amrr/Makefile
===================================================================
--- ath_rate_amrr/Makefile	(revision 182150)
+++ ath_rate_amrr/Makefile	(working copy)
@@ -61,8 +61,8 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-#	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
-	echo > opt_wlan.h
+#	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
+	echo > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: hifn/Makefile
===================================================================
--- hifn/Makefile	(revision 182150)
+++ hifn/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_hifn.h:
-	echo "#define HIFN_DEBUG 1" > opt_hifn.h
+	echo "#define HIFN_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: wlan_tkip/Makefile
===================================================================
--- wlan_tkip/Makefile	(revision 182150)
+++ wlan_tkip/Makefile	(working copy)
@@ -8,7 +8,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
+	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: linux/Makefile
===================================================================
--- linux/Makefile	(revision 182150)
+++ linux/Makefile	(working copy)
@@ -54,7 +54,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_inet6.h:
-	echo "#define INET6 1" > opt_inet6.h
+	echo "#define INET6 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: wlan_ccmp/Makefile
===================================================================
--- wlan_ccmp/Makefile	(revision 182150)
+++ wlan_ccmp/Makefile	(working copy)
@@ -10,7 +10,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_wlan.h:
-	echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
+	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: safe/Makefile
===================================================================
--- safe/Makefile	(revision 182150)
+++ safe/Makefile	(working copy)
@@ -34,7 +34,7 @@
 
 .if !defined(KERNBUILDDIR)
 opt_safe.h:
-	echo "#define SAFE_DEBUG 1" > opt_safe.h
+	echo "#define SAFE_DEBUG 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: if_tap/Makefile
===================================================================
--- if_tap/Makefile	(revision 182150)
+++ if_tap/Makefile	(working copy)
@@ -12,7 +12,7 @@
 	echo "#define COMPAT_FREEBSD6 1" > ${.TARGET}
 
 opt_inet.h:
-	echo "#define INET 1" > opt_inet.h
+	echo "#define INET 1" > ${.TARGET}
 .endif
 
 .include <bsd.kmod.mk>
Index: ctau/Makefile
===================================================================
--- ctau/Makefile	(revision 182150)
+++ ctau/Makefile	(working copy)
@@ -15,12 +15,12 @@
 
 .if ${NETGRAPH} != 0
 opt_netgraph.h:
-	echo "#define NETGRAPH $(NETGRAPH)" > opt_netgraph.h
+	echo "#define NETGRAPH $(NETGRAPH)" > ${.TARGET}
 .endif
 
 .if ${NG_CRONYX} != 0
 opt_ng_cronyx.h:
-	echo "#define NETGRAPH_CRONYX 1" > opt_ng_cronyx.h
+	echo "#define NETGRAPH_CRONYX 1" > ${.TARGET}
 .endif
 .endif
 

----Next_Part(Mon_Aug_25_01_15_13_2008_547)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080825.011513.-432836673.imp>