freebsd-skq/release/picobsd/build/munge_crunchmk.pl
joe 8791fdf576 Post process the crunch1.mk file to allow make arguments to passed on
a per program basis allowing a greater control on what is built.

The buildopts file contains Makefile lines of form:

	# Anything added to OPTS is added to every build rule.
	OPTS= -DNOPAM

	# These should only be added to the build of user-ppp.
	ppp_OPTS= -DNOKLDLOAD -DNOINET6 -DNONAT -DNOATM -DNOSUID \
		-DHAVE_DES -DNORADIUS -DNOI4B -DNONETGRAPH

Really these should be added to crunch.inc, but that file is currently
optional, and if defined masks the global one.  Next step will be to move
these global settings back out into the individual builds as OPTS, and
then migrate OPTS and prog_OPTS back into the local crunch.inc file.
2000-11-02 13:16:43 +00:00

31 lines
648 B
Perl
Executable File

#!/usr/bin/perl -wi
# Post process a crunch1.mk file:
#
# from...
# ftp_make:
# (cd $(ftp_SRCDIR) && make depend && make $(ftp_OBJS))
#
# to...
# ftp_make:
# (cd $(ftp_SRCDIR) && make obj && make depend && make $(OPTS) $(ftp_OPTS) $(ftp_OBJS))
use strict;
while (my $line = <>) {
if ( $line =~ /(.*)make depend && make (\$\((.*?)_OBJS\).*)/ ) {
my $start = $1; # The start of the line.
my $end = $2; # The end of the line.
my $prog = $3; # The parsed out name of the program.
print $start;
print 'make obj && make depend && ';
print 'make $(OPTS) $(' . $prog . '_OPTS) ';
print $end, "\n";
} else {
print $line;
}
}
#end