diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1994-05-30 19:09:18 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1994-05-30 19:09:18 +0000 |
commit | b0d61785cae024b1f44119446a940ee14c9ac959 (patch) | |
tree | 5a495a583b002ae9e57f09848ae697160708c220 /share/mk | |
parent | d43599f73ba5858e573c7ad8b284f6a0808c5c93 (diff) | |
download | FreeBSD-src-b0d61785cae024b1f44119446a940ee14c9ac959.zip FreeBSD-src-b0d61785cae024b1f44119446a940ee14c9ac959.tar.gz |
BSD 4.4 Lite Share Sources
Diffstat (limited to 'share/mk')
-rw-r--r-- | share/mk/Makefile | 12 | ||||
-rw-r--r-- | share/mk/bsd.README | 300 | ||||
-rw-r--r-- | share/mk/bsd.doc.mk | 53 | ||||
-rw-r--r-- | share/mk/bsd.lib.mk | 171 | ||||
-rw-r--r-- | share/mk/bsd.man.mk | 58 | ||||
-rw-r--r-- | share/mk/bsd.prog.mk | 201 | ||||
-rw-r--r-- | share/mk/bsd.subdir.mk | 80 | ||||
-rw-r--r-- | share/mk/sys.mk | 101 |
8 files changed, 976 insertions, 0 deletions
diff --git a/share/mk/Makefile b/share/mk/Makefile new file mode 100644 index 0000000..d284ff2 --- /dev/null +++ b/share/mk/Makefile @@ -0,0 +1,12 @@ +# @(#)Makefile 8.1 (Berkeley) 6/8/93 + +FILES= bsd.doc.mk bsd.lib.mk bsd.man.mk bsd.prog.mk bsd.subdir.mk sys.mk +NOOBJ= noobj + +all clean cleandir depend lint tags: + +install: + install -c -o ${BINOWN} -g ${BINOWN} -m 444 ${FILES} \ + ${DESTDIR}${BINDIR}/mk + +.include <bsd.prog.mk> diff --git a/share/mk/bsd.README b/share/mk/bsd.README new file mode 100644 index 0000000..0b34f5f --- /dev/null +++ b/share/mk/bsd.README @@ -0,0 +1,300 @@ +# @(#)bsd.README 8.2 (Berkeley) 4/2/94 + +This is the README file for the new make "include" files for the BSD +source tree. The files are installed in /usr/share/mk, and are, by +convention, named with the suffix ".mk". Each ".mk" file has a +corresponding ".rd" file which is an explanation of the ".mk" file. + +Note, this file is not intended to replace reading through the .mk +files for anything tricky. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +RANDOM THINGS WORTH KNOWING: + +The files are simply C-style #include files, and pretty much behave like +you'd expect. The syntax is slightly different in that a single '.' is +used instead of the hash mark, i.e. ".include <bsd.prog.mk>". + +One difference that will save you lots of debugging time is that inclusion +of the file is normally done at the *end* of the Makefile. The reason for +this is because .mk files often modify variables and behavior based on the +values of variables set in the Makefile. To make this work, remember that +the FIRST target found is the target that is used, i.e. if the Makefile has: + + a: + echo a + a: + echo a number two + +the command "make a" will echo "a". To make things confusing, the SECOND +variable assignment is the overriding one, i.e. if the Makefile has: + + a= foo + a= bar + + b: + echo ${a} + +the command "make b" will echo "bar". This is for compatibility with the +way the V7 make behaved. + +It's fairly difficult to make the BSD .mk files work when you're building +multiple programs in a single directory. It's a lot easier split up the +programs than to deal with the problem. Most of the agony comes from making +the "obj" directory stuff work right, not because we switch to a new version +of make. So, don't get mad at us, figure out a better way to handle multiple +architectures so we can quit using the symbolic link stuff. (Imake doesn't +count.) + +The file .depend in the source directory is expected to contain dependencies +for the source files. This file is read automatically by make after reading +the Makefile. + +The variable DESTDIR works as before. It's not set anywhere but will change +the tree where the file gets installed. + +The profiled libraries are no longer built in a different directory than +the regular libraries. A new suffix, ".po", is used to denote a profiled +object. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +The include file <sys.mk> has the default rules for all makes, in the BSD +environment or otherwise. You probably don't want to touch this file. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +The include file <bsd.man.mk> handles installing manual pages and their +links. + +It has a single target: + + maninstall: + Install the manual pages and their links. + +It sets/uses the following variables: + +MANDIR Base path for manual installation. + +MANGRP Manual group. + +MANOWN Manual owner. + +MANMODE Manual mode. + +MANSUBDIR Subdirectory under the manual page section, i.e. "/vax" + or "/tahoe" for machine specific manual pages. + +MAN1 ... MAN8 The manual pages to be installed (use a .0 suffix). + +MLINKS List of manual page links (using a .1 - .8 suffix). The + linked-to file must come first, the linked file second, + and there may be multiple pairs. The files are soft-linked. + +The include file <bsd.man.mk> includes a file named "../Makefile.inc" if +it exists. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +The include file <bsd.own.mk> contains the owners, groups, etc. for both +manual pages and binaries. + +It has no targets. + +It sets/uses the following variables: + +BINGRP Binary group. + +BINOWN Binary owner. + +BINMODE Binary mode. + +STRIP The flag passed to the install program to cause the binary + to be stripped. This is to be used when building your + own install script so that the entire system can be made + stripped/not-stripped using a single nob. + +MANDIR Base path for manual installation. + +MANGRP Manual group. + +MANOWN Manual owner. + +MANMODE Manual mode. + +This file is generally useful when building your own Makefiles so that +they use the same default owners etc. as the rest of the tree. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +The include file <bsd.prog.mk> handles building programs from one or +more source files, along with their manual pages. It has a limited number +of suffixes, consistent with the current needs of the BSD tree. + +It has seven targets: + + all: + build the program and its manual page + clean: + remove the program, any object files and the files a.out, + Errs, errs, mklog, and ${PROG}.core. + cleandir: + remove all of the files removed by the target clean, as + well as .depend, tags, and any manual pages. + depend: + make the dependencies for the source files, and store + them in the file .depend. + install: + install the program and its manual pages; if the Makefile + does not itself define the target install, the targets + beforeinstall and afterinstall may also be used to cause + actions immediately before and after the install target + is executed. + lint: + run lint on the source files + tags: + create a tags file for the source files. + +It sets/uses the following variables: + +BINGRP Binary group. + +BINOWN Binary owner. + +BINMODE Binary mode. + +CLEANFILES Additional files to remove for the clean and cleandir targets. + +COPTS Additional flags to the compiler when creating C objects. + +HIDEGAME If HIDEGAME is defined, the binary is installed in + /usr/games/hide, and a symbolic link is created to + /usr/games/dm. + +LDADD Additional loader objects. Usually used for libraries. + For example, to load with the compatibility and utility + libraries, use: + + LDFILES=-lutil -lcompat + +LDFLAGS Additional loader flags. + +LINKS The list of binary links; should be full pathnames, the + linked-to file coming first, followed by the linked + file. The files are hard-linked. For example, to link + /bin/test and /bin/[, use: + + LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[ + +MAN1...MAN8 Manual pages (should end in .0). If no MAN variable is + defined, "MAN1=${PROG}.0" is assumed. + +PROG The name of the program to build. If not supplied, nothing + is built. + +SRCS List of source files to build the program. If PROG is not + defined, it's assumed to be ${PROG}.c. + +DPADD Additional dependencies for the program. Usually used for + libraries. For example, to depend on the compatibility and + utility libraries use: + + SRCLIB=${LIBCOMPAT} ${LIBUTIL} + + The following libraries are predefined for DPADD: + + LIBC /lib/libc.a + LIBCOMPAT /usr/lib/libcompat.a + LIBCURSES /usr/lib/libcurses.a + LIBDBM /usr/lib/libdbm.a + LIBDES /usr/lib/libdes.a + LIBL /usr/lib/libl.a + LIBKDB /usr/lib/libkdb.a + LIBKRB /usr/lib/libkrb.a + LIBM /usr/lib/libm.a + LIBMP /usr/lib/libmp.a + LIBPC /usr/lib/libpc.a + LIBPLOT /usr/lib/libplot.a + LIBRPC /usr/lib/sunrpc.a + LIBTERM /usr/lib/libterm.a + LIBUTIL /usr/lib/libutil.a + +SHAREDSTRINGS If defined, a new .c.o rule is used that results in shared + strings, using xstr(1). + +STRIP The flag passed to the install program to cause the binary + to be stripped. + +SUBDIR A list of subdirectories that should be built as well. + Each of the targets will execute the same target in the + subdirectories. + +The include file <bsd.prog.mk> includes the file named "../Makefile.inc" +if it exists, as well as the include file <bsd.man.mk>. + +Some simple examples: + +To build foo from foo.c with a manual page foo.1, use: + + PROG= foo + + .include <bsd.prog.mk> + +To build foo from foo.c with a manual page foo.2, add the line: + + MAN2= foo.0 + +If foo does not have a manual page at all, add the line: + + NOMAN= noman + +If foo has multiple source files, add the line: + + SRCS= a.c b.c c.c d.c + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +The include file <bsd.subdir.mk> contains the default targets for building +subdirectories. It has the same seven targets as <bsd.prog.mk>: all, clean, +cleandir, depend, install, lint, and tags. For all of the directories +listed in the variable SUBDIRS, the specified directory will be visited +and the target made. There is also a default target which allows the +command "make subdir" where subdir is any directory listed in the variable +SUBDIRS. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +The include file <bsd.lib.mk> has support for building libraries. It has +the same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend, +install, lint, and tags. It has a limited number of suffixes, consistent +with the current needs of the BSD tree. + +It sets/uses the following variables: + +LIBDIR Target directory for libraries. + +LINTLIBDIR Target directory for lint libraries. + +LIBGRP Library group. + +LIBOWN Library owner. + +LIBMODE Library mode. + +LDADD Additional loader objects. + +MAN1 ... MAN8 The manual pages to be installed (use a .0 suffix). + +SRCS List of source files to build the library. Suffix types + .s, .c, and .f are supported. Note, .s files are preferred + to .c files of the same name. (This is not the default for + versions of make.) + +The include file <bsd.lib.mk> includes the file named "../Makefile.inc" +if it exists, as well as the include file <bsd.man.mk>. + +It has rules for building profiled objects; profiled libraries are +built by default. + +Libraries are ranlib'd before installation. diff --git a/share/mk/bsd.doc.mk b/share/mk/bsd.doc.mk new file mode 100644 index 0000000..2b6f128 --- /dev/null +++ b/share/mk/bsd.doc.mk @@ -0,0 +1,53 @@ +# @(#)bsd.doc.mk 8.1 (Berkeley) 8/14/93 + +BIB?= bib +EQN?= eqn +GREMLIN?= grn +GRIND?= vgrind -f +INDXBIB?= indxbib +PIC?= pic +REFER?= refer +ROFF?= groff -M/usr/share/tmac -M/usr/old/lib/tmac ${MACROS} ${PAGES} +SOELIM?= soelim +TBL?= tbl + +.PATH: ${.CURDIR} + +.if !target(all) +.MAIN: all +all: paper.ps +.endif + +.if !target(paper.ps) +paper.ps: ${SRCS} + ${ROFF} ${SRCS} > ${.TARGET} +.endif + +.if !target(print) +print: paper.ps + lpr -P${PRINTER} paper.ps +.endif + +.if !target(manpages) +manpages: +.endif + +.if !target(obj) +obj: +.endif + +clean cleandir: + rm -f paper.* [eE]rrs mklog ${CLEANFILES} + +FILES?= ${SRCS} +install: + install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ + Makefile ${FILES} ${EXTRA} ${DESTDIR}${BINDIR}/${DIR} + +spell: ${SRCS} + spell ${SRCS} | sort | comm -23 - spell.ok > paper.spell + +BINDIR?= /usr/share/doc +BINGRP?= bin +BINOWN?= bin +BINMODE?= 444 diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk new file mode 100644 index 0000000..c52cb08 --- /dev/null +++ b/share/mk/bsd.lib.mk @@ -0,0 +1,171 @@ +# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 + +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif + +LIBDIR?= /usr/lib +LINTLIBDIR?= /usr/libdata/lint +LIBGRP?= bin +LIBOWN?= bin +LIBMODE?= 444 + +STRIP?= -s + +BINGRP?= bin +BINOWN?= bin +BINMODE?= 555 + +.MAIN: all + +# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries +.SUFFIXES: +.SUFFIXES: .out .o .po .s .c .f .y .l .8 .7 .6 .5 .4 .3 .2 .1 .0 .m4 + +.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: + nroff -man ${.IMPSRC} > ${.TARGET} + +.c.o: + ${CC} ${CFLAGS} -c ${.IMPSRC} + @${LD} -x -r ${.TARGET} + @mv a.out ${.TARGET} + +.c.po: + ${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + @${LD} -X -r ${.TARGET} + @mv a.out ${.TARGET} + +.s.o: + ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ + ${AS} -o ${.TARGET} + @${LD} -x -r ${.TARGET} + @mv a.out ${.TARGET} + +.s.po: + ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ + ${AS} -o ${.TARGET} + @${LD} -X -r ${.TARGET} + @mv a.out ${.TARGET} + +MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} +manpages: ${MANALL} + +.if !defined(NOPROFILE) +_LIBS=lib${LIB}.a lib${LIB}_p.a +.else +_LIBS=lib${LIB}.a +.endif + +all: ${_LIBS} # llib-l${LIB}.ln +.if !defined(NOMAN) +all: ${MANALL} +.endif + +OBJS+= ${SRCS:R:S/$/.o/g} + +lib${LIB}.a:: ${OBJS} + @echo building standard ${LIB} library + @rm -f lib${LIB}.a + @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD} + ranlib lib${LIB}.a + +POBJS+= ${OBJS:.o=.po} +lib${LIB}_p.a:: ${POBJS} + @echo building profiled ${LIB} library + @rm -f lib${LIB}_p.a + @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD} + ranlib lib${LIB}_p.a + +llib-l${LIB}.ln: ${SRCS} + ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} + +.if !target(clean) +clean: + rm -f ${OBJS} + rm -f ${POBJS} + rm -f a.out [Ee]rrs mklog ${CLEANFILES} \ + profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln +.endif + +.if !target(cleandir) +cleandir: + rm -f ${OBJS} + rm -f ${POBJS} + rm -f a.out [Ee]rrs mklog ${CLEANFILES} \ + profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln + rm -f ${MANALL} .depend +.endif + +.if !target(depend) +depend: .depend +.depend: ${SRCS} + mkdep ${CFLAGS:M-[ID]*} ${AINC} ${.ALLSRC} + @(TMP=/tmp/_depend$$$$; \ + sed -e 's/^\([^\.]*\).o *:/\1.o \1.po:/' < .depend > $$TMP; \ + mv $$TMP .depend) +.endif + +.if !target(install) +.if !target(beforeinstall) +beforeinstall: +.endif + +realinstall: beforeinstall + ranlib lib${LIB}.a + install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \ + ${DESTDIR}${LIBDIR} + ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a +.if !defined(NOPROFILE) + ranlib lib${LIB}_p.a + install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + lib${LIB}_p.a ${DESTDIR}${LIBDIR} + ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a +.endif +# install -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ +# llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR} +.if defined(LINKS) && !empty(LINKS) + @set ${LINKS}; \ + while test $$# -ge 2; do \ + l=${DESTDIR}$$1; \ + shift; \ + t=${DESTDIR}$$1; \ + shift; \ + echo $$t -\> $$l; \ + rm -f $$t; \ + ln $$l $$t; \ + done; true +.endif + +install: afterinstall +afterinstall: realinstall +.if !defined(NOMAN) +afterinstall: maninstall +.endif +.endif + +.if !target(lint) +lint: +.endif + +.if !target(tags) +tags: ${SRCS} + -ctags -f /dev/stdout ${.ALLSRC:M*.c} | \ + sed "s;\${.CURDIR}/;;" > ${.CURDIR}/tags +.endif + +.include <bsd.man.mk> +.if !target(obj) +.if defined(NOOBJ) +obj: +.else +obj: + @cd ${.CURDIR}; rm -rf obj; \ + here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ + echo "$$here -> $$dest"; ln -s $$dest obj; \ + if test -d /usr/obj -a ! -d $$dest; then \ + mkdir -p $$dest; \ + else \ + true; \ + fi; +.endif +.endif diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk new file mode 100644 index 0000000..99f3a0e --- /dev/null +++ b/share/mk/bsd.man.mk @@ -0,0 +1,58 @@ +# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93 + +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif + +MANGRP?= bin +MANOWN?= bin +MANMODE?= 444 + +MANDIR?= /usr/share/man/cat + +MINSTALL= install -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} + +maninstall: +.if defined(MAN1) && !empty(MAN1) + ${MINSTALL} ${MAN1} ${DESTDIR}${MANDIR}1${MANSUBDIR} +.endif +.if defined(MAN2) && !empty(MAN2) + ${MINSTALL} ${MAN2} ${DESTDIR}${MANDIR}2${MANSUBDIR} +.endif +.if defined(MAN3) && !empty(MAN3) + ${MINSTALL} ${MAN3} ${DESTDIR}${MANDIR}3${MANSUBDIR} +.endif +.if defined(MAN3F) && !empty(MAN3F) + ${MINSTALL} ${MAN3F} ${DESTDIR}${MANDIR}3f${MANSUBDIR} +.endif +.if defined(MAN4) && !empty(MAN4) + ${MINSTALL} ${MAN4} ${DESTDIR}${MANDIR}4${MANSUBDIR} +.endif +.if defined(MAN5) && !empty(MAN5) + ${MINSTALL} ${MAN5} ${DESTDIR}${MANDIR}5${MANSUBDIR} +.endif +.if defined(MAN6) && !empty(MAN6) + ${MINSTALL} ${MAN6} ${DESTDIR}${MANDIR}6${MANSUBDIR} +.endif +.if defined(MAN7) && !empty(MAN7) + ${MINSTALL} ${MAN7} ${DESTDIR}${MANDIR}7${MANSUBDIR} +.endif +.if defined(MAN8) && !empty(MAN8) + ${MINSTALL} ${MAN8} ${DESTDIR}${MANDIR}8${MANSUBDIR} +.endif +.if defined(MLINKS) && !empty(MLINKS) + @set ${MLINKS}; \ + while test $$# -ge 2; do \ + name=$$1; \ + shift; \ + dir=${DESTDIR}${MANDIR}`expr $$name : '[^\.]*\.\(.*\)'`; \ + l=$${dir}${MANSUBDIR}/`expr $$name : '\([^\.]*\)'`.0; \ + name=$$1; \ + shift; \ + dir=${DESTDIR}${MANDIR}`expr $$name : '[^\.]*\.\(.*\)'`; \ + t=$${dir}${MANSUBDIR}/`expr $$name : '\([^\.]*\)'`.0; \ + echo $$t -\> $$l; \ + rm -f $$t; \ + ln $$l $$t; \ + done; true +.endif diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk new file mode 100644 index 0000000..a27f616 --- /dev/null +++ b/share/mk/bsd.prog.mk @@ -0,0 +1,201 @@ +# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 + +.if !defined(NOINCLUDE) && exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif + +.SUFFIXES: .out .o .c .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0 + +.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: + nroff -man ${.IMPSRC} > ${.TARGET} + +CFLAGS+=${COPTS} + +STRIP?= -s + +BINGRP?= bin +BINOWN?= bin +BINMODE?= 555 + +LIBC?= /usr/lib/libc.a +LIBCOMPAT?= /usr/lib/libcompat.a +LIBCURSES?= /usr/lib/libcurses.a +LIBDBM?= /usr/lib/libdbm.a +LIBDES?= /usr/lib/libdes.a +LIBL?= /usr/lib/libl.a +LIBKDB?= /usr/lib/libkdb.a +LIBKRB?= /usr/lib/libkrb.a +LIBKVM?= /usr/lib/libkvm.a +LIBM?= /usr/lib/libm.a +LIBMP?= /usr/lib/libmp.a +LIBPC?= /usr/lib/libpc.a +LIBPLOT?= /usr/lib/libplot.a +LIBRESOLV?= /usr/lib/libresolv.a +LIBRPC?= /usr/lib/sunrpc.a +LIBTERM?= /usr/lib/libterm.a +LIBUTIL?= /usr/lib/libutil.a + +.if defined(SHAREDSTRINGS) +CLEANFILES+=strings +.c.o: + ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c - + @${CC} ${CFLAGS} -c x.c -o ${.TARGET} + @rm -f x.c +.endif + +.if defined(PROG) +.if defined(SRCS) + +OBJS+= ${SRCS:R:S/$/.o/g} + +${PROG}: ${OBJS} ${LIBC} ${DPADD} + ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} + +.else defined(SRCS) + +SRCS= ${PROG}.c + +${PROG}: ${SRCS} ${LIBC} ${DPADD} + ${CC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD} + +MKDEP= -p + +.endif + +.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ + !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ + !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) +MAN1= ${PROG}.0 +.endif +.endif +.if !defined(NOMAN) +MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} +.else +MANALL= +.endif +manpages: ${MANALL} + +_PROGSUBDIR: .USE +.if defined(SUBDIR) && !empty(SUBDIR) + @for entry in ${SUBDIR}; do \ + (echo "===> $$entry"; \ + if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ + cd ${.CURDIR}/$${entry}.${MACHINE}; \ + else \ + cd ${.CURDIR}/$${entry}; \ + fi; \ + ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ + done +.endif + +.if !target(all) +.MAIN: all +all: ${PROG} ${MANALL} _PROGSUBDIR +.endif + +.if !target(clean) +clean: _PROGSUBDIR + rm -f a.out [Ee]rrs mklog ${PROG}.core ${PROG} ${OBJS} ${CLEANFILES} +.endif + +.if !target(cleandir) +cleandir: _PROGSUBDIR + rm -f a.out [Ee]rrs mklog ${PROG}.core ${PROG} ${OBJS} ${CLEANFILES} + rm -f .depend ${MANALL} +.endif + +# some of the rules involve .h sources, so remove them from mkdep line +.if !target(depend) +depend: .depend _PROGSUBDIR +.depend: ${SRCS} +.if defined(PROG) + mkdep ${MKDEP} ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c} +.endif +.endif + +.if !target(install) +.if !target(beforeinstall) +beforeinstall: +.endif +.if !target(afterinstall) +afterinstall: +.endif + +realinstall: _PROGSUBDIR +.if defined(PROG) + install ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} +.endif +.if defined(HIDEGAME) + (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ + chown games.bin ${PROG}) +.endif +.if defined(LINKS) && !empty(LINKS) + @set ${LINKS}; \ + while test $$# -ge 2; do \ + l=${DESTDIR}$$1; \ + shift; \ + t=${DESTDIR}$$1; \ + shift; \ + echo $$t -\> $$l; \ + rm -f $$t; \ + ln $$l $$t; \ + done; true +.endif + +install: afterinstall maninstall +afterinstall: realinstall +realinstall: beforeinstall +.endif + +.if !target(lint) +lint: ${SRCS} _PROGSUBDIR +.if defined(PROG) + @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 +.endif +.endif + +.if !target(obj) +.if defined(NOOBJ) +obj: _PROGSUBDIR +.else +obj: _PROGSUBDIR + @cd ${.CURDIR}; rm -rf obj; \ + here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ + echo "$$here -> $$dest"; ln -s $$dest obj; \ + if test -d /usr/obj -a ! -d $$dest; then \ + mkdir -p $$dest; \ + else \ + true; \ + fi; +.endif +.endif + +.if !target(objdir) +.if defined(NOOBJ) +objdir: _PROGSUBDIR +.else +objdir: _PROGSUBDIR + @cd ${.CURDIR}; \ + here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ + if test -d /usr/obj -a ! -d $$dest; then \ + mkdir -p $$dest; \ + else \ + true; \ + fi; +.endif +.endif + +.if !target(tags) +tags: ${SRCS} _PROGSUBDIR +.if defined(PROG) + -ctags -f /dev/stdout ${.ALLSRC} | \ + sed "s;${.CURDIR}/;;" > ${.CURDIR}/tags +.endif +.endif + +.if !defined(NOMAN) +.include <bsd.man.mk> +.else +maninstall: +.endif diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk new file mode 100644 index 0000000..2ca9e83 --- /dev/null +++ b/share/mk/bsd.subdir.mk @@ -0,0 +1,80 @@ +# @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93 + +.MAIN: all + +STRIP?= -s + +BINGRP?= bin +BINOWN?= bin +BINMODE?= 555 + +_SUBDIRUSE: .USE + @for entry in ${SUBDIR}; do \ + (if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ + echo "===> $${entry}.${MACHINE}"; \ + cd ${.CURDIR}/$${entry}.${MACHINE}; \ + else \ + echo "===> $$entry"; \ + cd ${.CURDIR}/$${entry}; \ + fi; \ + ${MAKE} ${.TARGET:realinstall=install}); \ + done + +${SUBDIR}:: + @if test -d ${.TARGET}.${MACHINE}; then \ + cd ${.CURDIR}/${.TARGET}.${MACHINE}; \ + else \ + cd ${.CURDIR}/${.TARGET}; \ + fi; \ + ${MAKE} all + +.if !target(all) +all: _SUBDIRUSE +.endif + +.if !target(clean) +clean: _SUBDIRUSE +.endif + +.if !target(cleandir) +cleandir: _SUBDIRUSE +.endif + +.if !target(depend) +depend: _SUBDIRUSE +.endif + +.if !target(manpages) +manpages: _SUBDIRUSE +.endif + +.if !target(install) +.if !target(beforeinstall) +beforeinstall: +.endif +.if !target(afterinstall) +afterinstall: +.endif +install: afterinstall +afterinstall: realinstall +realinstall: beforeinstall _SUBDIRUSE +.endif +.if !target(maninstall) +maninstall: _SUBDIRUSE +.endif + +.if !target(lint) +lint: _SUBDIRUSE +.endif + +.if !target(obj) +obj: _SUBDIRUSE +.endif + +.if !target(objdir) +objdir: _SUBDIRUSE +.endif + +.if !target(tags) +tags: _SUBDIRUSE +.endif diff --git a/share/mk/sys.mk b/share/mk/sys.mk new file mode 100644 index 0000000..fd86a9d --- /dev/null +++ b/share/mk/sys.mk @@ -0,0 +1,101 @@ +# @(#)sys.mk 8.2 (Berkeley) 3/21/94 + +unix ?= We run UNIX. + +.SUFFIXES: .out .a .ln .o .c .F .f .e .r .y .l .s .cl .p .h + +.LIBS: .a + +AR ?= ar +ARFLAGS ?= rl +RANLIB ?= ranlib + +AS ?= as +AFLAGS ?= + +CC ?= gcc + +.if ${MACHINE} == "sparc" +CFLAGS ?= -O4 +.else +CFLAGS ?= -O2 +.endif + +CPP ?= cpp + +FC ?= f77 +FFLAGS ?= -O +EFLAGS ?= + +LEX ?= lex +LFLAGS ?= + +LD ?= ld +LDFLAGS ?= + +LINT ?= lint +LINTFLAGS ?= -chapbx + +MAKE ?= make + +PC ?= pc +PFLAGS ?= + +RC ?= f77 +RFLAGS ?= + +SHELL ?= sh + +YACC ?= yacc +YFLAGS ?= -d + +.c: + ${CC} ${CFLAGS} ${.IMPSRC} -o ${.TARGET} + +.c.o: + ${CC} ${CFLAGS} -c ${.IMPSRC} + +.p.o: + ${PC} ${PFLAGS} -c ${.IMPSRC} + +.e.o .r.o .F.o .f.o: + ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} + +.s.o: + ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} + +.y.o: + ${YACC} ${YFLAGS} ${.IMPSRC} + ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} + rm -f y.tab.c + +.l.o: + ${LEX} ${LFLAGS} ${.IMPSRC} + ${CC} ${CFLAGS} -c lex.yy.c -o ${.TARGET} + rm -f lex.yy.c + +.y.c: + ${YACC} ${YFLAGS} ${.IMPSRC} + mv y.tab.c ${.TARGET} + +.l.c: + ${LEX} ${LFLAGS} ${.IMPSRC} + mv lex.yy.c ${.TARGET} + +.s.out .c.out .o.out: + ${CC} ${CFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} + +.f.out .F.out .r.out .e.out: + ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${.IMPSRC} \ + ${LDLIBS} -o ${.TARGET} + rm -f ${.PREFIX}.o + +.y.out: + ${YACC} ${YFLAGS} ${.IMPSRC} + ${CC} ${CFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} + rm -f y.tab.c + +.l.out: + ${LEX} ${LFLAGS} ${.IMPSRC} + ${CC} ${CFLAGS} lex.yy.c ${LDLIBS} -ll -o ${.TARGET} + rm -f lex.yy.c |