Re: Makefile.yp aka /var/yp/Makefile.dist

From: Dan Nelson <dnelson_at_allantgroup.com>
Date: Thu, 12 Jun 2003 21:48:38 -0500
In the last episode (Jun 11), Ruslan Ermilov said:
> Just as a precaution, does anyone have any objections to my removing
> of these funny $^ sequences from Makefile.yp?  They were apparently
> used to insert something into the map generation pipeline just before
> the yp_mkdb(8) invokation, but recent additions to this file did not
> follow this "rule".
>
>  ypservers: $(YPSERVERS)
>  	_at_echo "Updating $_at_..."
>  	$(CAT) $(YPSERVERS) | \
> -	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $^ \
> +	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \
>  		| $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$_at_ - $(TMP); \
>  		$(RMV) $(TMP) $_at_
>  	_at_$(DBLOAD) -c

$^ is gmake syntax for "all prerequisites", but bsd make has never
recognized that particular variable, so afaik it has always been
ignored (rev 1.1 even has them).

There's also a useless use of cat in there.  If you wanted, you could
do something like this (for all targets except netgroup, which calls
revnetgroup inbetween cat and awk):

 ypservers: $(YPSERVERS)
 	_at_echo "Updating $_at_..."
-	$(CAT) $(YPSERVERS) | \
-	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $^ \
+	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $(YPSERVERS) \
 		| $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$_at_ - $(TMP); \
 		$(RMV) $(TMP) $_at_
 	_at_$(DBLOAD) -c

-- 
	Dan Nelson
	dnelson_at_allantgroup.com
Received on Thu Jun 12 2003 - 17:48:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:11 UTC