Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 May 1996 10:13:40 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        wollman@lcs.mit.edu, wosch@cs.tu-berlin.de
Cc:        current@FreeBSD.ORG
Subject:   Re: Files installed to /etc, (was: review request)
Message-ID:  <199605050013.KAA01448@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>The target `scriptinstall' works for all script languages extensions
>(.sh, .csh, .perl, .pl, .tcl, .el) and you can install more than one
>script (PROG support only one program).  FreeBSD has ~33 bourne shell
>scripts, 9 perl scripts and 1 csh script.

You can support all the extensions without using the `scriptinstall'
by adding implicit rules.

It would be nice to support multiple programs in general for the case
where there is only one source file per program and a simple rule for
transforming the source name to the target name.  Trivial makefiles
already get the build step right:

	$ echo 'all: foo bar' >makefile
	$ touch foo.c bar.sh
	$ make -n
	cc -O2 foo.c  -o foo
	cp -p bar.sh bar
	chmod a+x bar

This could be made to work in the bsd.prog.mk framework without depending
on implicit rules.  E.g., use ${PROGS} for the list of simple programs
and substitute in it to get the C programs, etc, and generate an explicit
rule for each.

... Here is an half finished implementation.  The obj directory stuff
isn't quite right.  I cut this out of bsd.man.mk and deleted one too
many complication from the install rule.

===
PROGS=	foo bar

# .include <bsd.simpleprog.mk>

# --- Explicitly included first version of bsd.simpleprog.mk ---.
all: all-progs				# XXX
install: all-progs-install		# XXX

all-progs: ${PROGS}
.for prog in ${PROGS}
.if exists(${prog:S/$/.c/})
${prog}: ${prog:S/$/.o/}
	cc ${LDFLAGS} ${.ALLSRC} -o ${.TARGET}
${prog:S/$/.o/}: ${prog:S/$/.c/}
	cc -c ${CFLAGS} ${.ALLSRC} -o ${.TARGET}
.endif
.if exists(${prog:S/$/.sh/})
${prog}: ${prog:S/$/.sh/}
	# Just forget about default .sh rule.
	# XXX should delete it from .SUFFIXES.
.endif
.endfor

all-progs-install::
.for prog in ${PROGS}
all-progs-install:: ${prog}
.if exists(${prog:S/$/.c/})
	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
		   ${prog} ${DESTDIR}${BINDIR}/${prog}
.endif
.if exists(${prog:S/$/.sh/})
	${INSTALL} ${COPY}          -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
		   ${prog:S/$/.sh/} ${DESTDIR}${BINDIR}/${prog}
.endif
.endfor
# --- End of explicitly included bsd.simpleprog.mk ---.

.include <bsd.prog.mk>
===

Bruce



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