From ee67778ca3abc6a091e5585e4c44d7c1a39e5833 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 7 May 2015 17:30:06 -0400 Subject: Fix 64-bit build --- Makefile | 11 +- pmake.hack/README | 7 + pmake.hack/bsd.dep.mk | 62 ++++++++ pmake.hack/bsd.doc.mk | 78 ++++++++++ pmake.hack/bsd.files.mk | 43 +++++ pmake.hack/bsd.inc.mk | 25 +++ pmake.hack/bsd.info.mk | 60 +++++++ pmake.hack/bsd.kinc.mk | 136 ++++++++++++++++ pmake.hack/bsd.kmod.mk | 95 ++++++++++++ pmake.hack/bsd.lib.mk | 396 +++++++++++++++++++++++++++++++++++++++++++++++ pmake.hack/bsd.links.mk | 43 +++++ pmake.hack/bsd.man.mk | 156 +++++++++++++++++++ pmake.hack/bsd.nls.mk | 64 ++++++++ pmake.hack/bsd.obj.mk | 54 +++++++ pmake.hack/bsd.own.mk | 257 ++++++++++++++++++++++++++++++ pmake.hack/bsd.prog.mk | 202 ++++++++++++++++++++++++ pmake.hack/bsd.subdir.mk | 34 ++++ pmake.hack/bsd.sys.mk | 110 +++++++++++++ pmake.hack/sys.mk | 207 +++++++++++++++++++++++++ tetris/Makefile | 2 +- 20 files changed, 2040 insertions(+), 2 deletions(-) create mode 100644 pmake.hack/README create mode 100644 pmake.hack/bsd.dep.mk create mode 100644 pmake.hack/bsd.doc.mk create mode 100644 pmake.hack/bsd.files.mk create mode 100644 pmake.hack/bsd.inc.mk create mode 100644 pmake.hack/bsd.info.mk create mode 100644 pmake.hack/bsd.kinc.mk create mode 100644 pmake.hack/bsd.kmod.mk create mode 100644 pmake.hack/bsd.lib.mk create mode 100644 pmake.hack/bsd.links.mk create mode 100644 pmake.hack/bsd.man.mk create mode 100644 pmake.hack/bsd.nls.mk create mode 100644 pmake.hack/bsd.obj.mk create mode 100644 pmake.hack/bsd.own.mk create mode 100644 pmake.hack/bsd.prog.mk create mode 100644 pmake.hack/bsd.subdir.mk create mode 100644 pmake.hack/bsd.sys.mk create mode 100644 pmake.hack/sys.mk diff --git a/Makefile b/Makefile index 75fd54f..a255057 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,13 @@ PMAKE=pmake INC:=$(shell pwd)/include CFLAGS="$(OPTFLAGS) -I$(INC) -include bsdcompat.h -std=gnu99" +# Slackware64's pmake ships with broken includes. +ifeq ($(shell uname -m),x86_64) +PMAKEHACK="MAKESYSPATH=$(shell pwd)/pmake.hack" +else +PMAKEHACK=/usr/share/mk +endif + # Which games are we building? DIRS=boggle bs cgram ching colorbars \ dab dm grdc hack hals_end larn \ @@ -33,10 +40,12 @@ SGIDBINS=tetris rogue hack SAVEDIRS=hackdir larn all: - for dir in $(DIRS); do ( cd $$dir && $(PMAKE) CFLAGS=$(CFLAGS) ); done + export $(PMAKEHACK) ; \ + for dir in $(DIRS); do ( cd $$dir && $(PMAKE) CFLAGS=$(CFLAGS) ); done ; \ [ -x boggle/mkdict/mkdict ] && cd boggle && $(PMAKE) realall clean: + export $(PMAKEHACK) ; \ for dir in $(DIRS); do ( cd $$dir && $(PMAKE) clean ); done install: install_files fix_perms diff --git a/pmake.hack/README b/pmake.hack/README new file mode 100644 index 0000000..e53c640 --- /dev/null +++ b/pmake.hack/README @@ -0,0 +1,7 @@ +Slackware64's pmake is broken: the includes /usr/share/mk/*.mk all say +things like 'LIBC=/usr/lib64/libc.a' (the lib should be lib64). These +files *have* to exist, whether they're actually needed or not (and they're +not, since they're static libs and we're building dynamic binaries). + +This directory contains fixed versions of the mk includes, for pmake's -m +option to use. diff --git a/pmake.hack/bsd.dep.mk b/pmake.hack/bsd.dep.mk new file mode 100644 index 0000000..03e407b --- /dev/null +++ b/pmake.hack/bsd.dep.mk @@ -0,0 +1,62 @@ +# $NetBSD: bsd.dep.mk,v 1.26 1999/02/24 22:04:15 simonb Exp $ + +.PHONY: cleandepend +cleandir distclean: cleandepend + +MKDEP?= mkdep + +# some of the rules involve .h sources, so remove them from mkdep line +depend: beforedepend +.if defined(SRCS) +depend: .depend + @true # hack to prevent "make depend" from using implicit rules +.NOPATH: .depend +.depend: ${SRCS} ${DPSRCS} + @rm -f .depend + @files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}"; \ + if [ "$$files" != " " ]; then \ + echo ${MKDEP} -a ${MKDEPFLAGS} \ + ${AFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${AINC:Q} $$files; \ + ${MKDEP} -a ${MKDEPFLAGS} \ + ${AFLAGS:M-[ID]*} ${CPPFLAGS} ${AINC} $$files; \ + fi + @files="${.ALLSRC:M*.c}"; \ + if [ "$$files" != "" ]; then \ + echo ${MKDEP} -a ${MKDEPFLAGS} \ + ${CFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \ + ${MKDEP} -a ${MKDEPFLAGS} \ + ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \ + fi + @files="${.ALLSRC:M*.m}"; \ + if [ "$$files" != "" ]; then \ + echo ${MKDEP} -a ${MKDEPFLAGS} \ + ${OBJCFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \ + ${MKDEP} -a ${MKDEPFLAGS} \ + ${OBJCFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \ + fi + @files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}"; \ + if [ "$$files" != " " ]; then \ + echo ${MKDEP} -a ${MKDEPFLAGS} \ + ${CXXFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \ + ${MKDEP} -a ${MKDEPFLAGS} \ + ${CXXFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \ + fi +cleandepend: + rm -f .depend ${.CURDIR}/tags +.else +cleandepend: +.endif +depend: afterdepend + +beforedepend: +afterdepend: + +.if !target(tags) +.if defined(SRCS) +tags: ${SRCS} + -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ + sed "s;\${.CURDIR}/;;" > tags +.else +tags: +.endif +.endif diff --git a/pmake.hack/bsd.doc.mk b/pmake.hack/bsd.doc.mk new file mode 100644 index 0000000..c03d072 --- /dev/null +++ b/pmake.hack/bsd.doc.mk @@ -0,0 +1,78 @@ +# $NetBSD: bsd.doc.mk,v 1.41 1999/02/12 01:10:06 lukem Exp $ +# @(#)bsd.doc.mk 8.1 (Berkeley) 8/14/93 + +.if !target(__initialized__) +__initialized__: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif +.include +.MAIN: all +.endif + +.PHONY: cleandoc docinstall print spell +.if ${MKSHARE} != "no" +realinstall: docinstall +.endif +clean cleandir distclean: cleandoc + +BIB?= bib +EQN?= eqn +GREMLIN?= grn +GRIND?= vgrind -f +INDXBIB?= indxbib +PIC?= pic +REFER?= refer +ROFF?= groff ${MACROS} ${PAGES} +SOELIM?= soelim +TBL?= tbl + +.if !target(all) +.if ${MKSHARE} != "no" +all: paper.ps +.else +all: +.endif +.endif + +.if !target(paper.ps) +paper.ps: ${SRCS} + ${ROFF} ${.ALLSRC} > ${.TARGET} +.endif + +.if !target(print) +print: paper.ps + lpr -P${PRINTER} ${.ALLSRC} +.endif + +cleandoc: + rm -f paper.* [eE]rrs mklog ${CLEANFILES} + +.if ${MKDOC} != "no" +FILES?= ${SRCS} +.for F in ${FILES} ${EXTRA} Makefile +docinstall:: ${DESTDIR}${DOCDIR}/${DIR}/${F} +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${DOCDIR}/${DIR}/${F} +.endif +.if !defined(BUILD) +${DESTDIR}${DOCDIR}/${DIR}/${F}: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${DOCDIR}/${DIR}/${F} +${DESTDIR}${DOCDIR}/${DIR}/${F}: ${F} + ${INSTALL} ${RENAME} ${PRESERVE} -c -o ${DOCOWN} -g ${DOCGRP} \ + -m ${DOCMODE} ${.ALLSRC} ${.TARGET} +.endfor +.endif + +.if !target(docinstall) +docinstall:: +.endif + +spell: ${SRCS} + spell ${.ALLSRC} | sort | comm -23 - spell.ok > paper.spell + +depend includes lint obj tags: + +.include diff --git a/pmake.hack/bsd.files.mk b/pmake.hack/bsd.files.mk new file mode 100644 index 0000000..4f63565 --- /dev/null +++ b/pmake.hack/bsd.files.mk @@ -0,0 +1,43 @@ +# $NetBSD: bsd.files.mk,v 1.8 1999/02/11 13:25:42 tv Exp $ + +# This file can be included multiple times. It clears the definition of +# FILES at the end so that this is possible. + +.PHONY: filesinstall +realinstall: filesinstall + +.if defined(FILES) && !empty(FILES) +FILESDIR?=${BINDIR} +FILESOWN?=${BINOWN} +FILESGRP?=${BINGRP} +FILESMODE?=${NONBINMODE} +.for F in ${FILES} +FILESDIR_${F}?=${FILESDIR} +FILESOWN_${F}?=${FILESOWN} +FILESGRP_${F}?=${FILESGRP} +FILESMODE_${F}?=${FILESMODE} +.if defined(FILESNAME) +FILESNAME_${F} ?= ${FILESNAME} +.else +FILESNAME_${F} ?= ${F:T} +.endif +filesinstall:: ${DESTDIR}${FILESDIR_${F}}/${FILESNAME_${F}} +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${FILESDIR_${F}}/${FILESNAME_${F}} +.endif +.if !defined(BUILD) +${DESTDIR}${FILESDIR_${F}}/${FILESNAME_${F}}: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${FILESDIR_${F}}/${FILESNAME_${F}} +${DESTDIR}${FILESDIR_${F}}/${FILESNAME_${F}}: ${F} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${FILESOWN_${F}} \ + -g ${FILESGRP_${F}} -m ${FILESMODE_${F}} ${.ALLSRC} ${.TARGET} +.endfor +.endif + +.if !target(filesinstall) +filesinstall:: +.endif + +FILES:= diff --git a/pmake.hack/bsd.inc.mk b/pmake.hack/bsd.inc.mk new file mode 100644 index 0000000..ff527ba --- /dev/null +++ b/pmake.hack/bsd.inc.mk @@ -0,0 +1,25 @@ +# $NetBSD: bsd.inc.mk,v 1.12 1999/02/04 11:58:30 christos Exp $ + +.PHONY: incinstall +includes: ${INCS} incinstall + +.if defined(INCS) +.for I in ${INCS} +incinstall:: ${DESTDIR}${INCSDIR}/$I + +.PRECIOUS: ${DESTDIR}${INCSDIR}/$I +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${INCSDIR}/$I +.endif +${DESTDIR}${INCSDIR}/$I: $I + @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ + (echo "${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} \ + -g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}) +.endfor +.endif + +.if !target(incinstall) +incinstall:: +.endif diff --git a/pmake.hack/bsd.info.mk b/pmake.hack/bsd.info.mk new file mode 100644 index 0000000..bb47a80 --- /dev/null +++ b/pmake.hack/bsd.info.mk @@ -0,0 +1,60 @@ +# $NetBSD: bsd.info.mk,v 1.7.2.1 1999/04/22 14:46:13 perry Exp $ + +.if !target(__initialized__) +__initialized__: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif +.include +.include +.MAIN: all +.endif + +MAKEINFO?= makeinfo +INFOFLAGS?= +INSTALL_INFO?= install-info + +.SUFFIXES: .txi .texi .texinfo .info + +.txi.info .texi.info .texinfo.info: + @${MAKEINFO} ${INFOFLAGS} --no-split -o $@ $< + +.if defined(TEXINFO) && !empty(TEXINFO) && ${MKINFO} != "no" +INFOFILES= ${TEXINFO:C/\.te?xi(nfo)?$/.info/} +FILES+= ${INFOFILES} + +infoinstall: +.for F in ${INFOFILES} + @${INSTALL_INFO} --remove --info-dir=${DESTDIR}${INFODIR} ${DESTDIR}${INFODIR}/${F} + ${INSTALL_INFO} --info-dir=${DESTDIR}${INFODIR} ${DESTDIR}${INFODIR}/${F} +.endfor + +.for F in ${INFOFILES} +FILESDIR_${F}= ${INFODIR} +FILESOWN_${F}= ${INFOOWN} +FILESGRP_${F}= ${INFOGRP} +FILESMODE_${F}= ${INFOMODE} +FILESNAME_${F}= ${F:T} +.endfor + +all: ${INFOFILES} +.else +all: +.endif + +.if ${MKINFO} != "no" +cleaninfo: + rm -f ${INFOFILES} +.else +cleaninfo infoinstall: +.endif + +.include + +# These need to happen *after* filesinstall. +.PHONY: infoinstall cleaninfo +realinstall: infoinstall +cleandir distclean: cleaninfo + +# Make sure all of the standard targets are defined, even if they do nothing. +clean depend includes lint regress tags: diff --git a/pmake.hack/bsd.kinc.mk b/pmake.hack/bsd.kinc.mk new file mode 100644 index 0000000..377c108 --- /dev/null +++ b/pmake.hack/bsd.kinc.mk @@ -0,0 +1,136 @@ +# $NetBSD: bsd.kinc.mk,v 1.5 1999/02/04 11:58:30 christos Exp $ + +# System configuration variables: +# +# SYS_INCLUDE "symlinks": symlinks to include directories are created. +# This may not work 100% properly for all headers. +# +# "copies": directories are made, if necessary, and headers +# are installed into them. +# +# Variables: +# +# INCSDIR Directory to install includes into (and/or make, and/or +# symlink, depending on what's going on). +# +# KDIR Kernel directory to symlink to, if SYS_INCLUDE is symlinks. +# If unspecified, no action will be taken when making include +# for the directory if SYS_INCLUDE is symlinks. +# +# INCS Headers to install, if SYS_INCLUDE is copies. +# +# DEPINCS Headers to install which are built dynamically. +# +# SUBDIR Subdirectories to enter +# +# SYMLINKS Symlinks to make (unconditionally), a la bsd.links.mk. +# Note that the original bits will be 'rm -rf'd rather than +# just 'rm -f'd, to make the right thing happen with include +# directories. +# + +.if !target(__initialized__) +__initialized__: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif +.include +.MAIN: all +.endif + +# Change SYS_INCLUDE in bsd.own.mk or /etc/mk.conf to "symlinks" if you +# don't want copies +SYS_INCLUDE?= copies + +# If DESTDIR is set, we're probably building a release, so force "copies". +.if defined(DESTDIR) && (${DESTDIR} != "/" && !empty(DESTDIR)) +SYS_INCLUDE= copies +.endif + + +.PHONY: incinstall +includes: ${INCS} incinstall + + +.if ${SYS_INCLUDE} == "symlinks" + +# don't install includes, just make symlinks. + +.if defined(KDIR) +SYMLINKS+= ${KDIR} ${INCSDIR} +.endif + +.else # not symlinks + +# make sure the directory is OK, and install includes. + +.PRECIOUS: ${DESTDIR}${INCSDIR} +.PHONY: ${DESTDIR}${INCSDIR} +${DESTDIR}${INCSDIR}: + @if [ ! -d ${.TARGET} ] || [ -L ${.TARGET} ] ; then \ + echo creating ${.TARGET}; \ + /bin/rm -rf ${.TARGET}; \ + ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 ${.TARGET}; \ + fi + +incinstall:: ${DESTDIR}${INCSDIR} + +.if defined(INCS) +.for I in ${INCS} +incinstall:: ${DESTDIR}${INCSDIR}/$I + +.PRECIOUS: ${DESTDIR}${INCSDIR}/$I +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${INCSDIR}/$I +.endif +${DESTDIR}${INCSDIR}/$I: ${DESTDIR}${INCSDIR} $I + @cmp -s ${.CURDIR}/$I ${.TARGET} > /dev/null 2>&1 || \ + (echo "${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} \ + -g ${BINGRP} -m ${NONBINMODE} ${.CURDIR}/$I ${.TARGET}" && \ + ${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.CURDIR}/$I ${.TARGET}) +.endfor +.endif + +.if defined(DEPINCS) +.for I in ${DEPINCS} +incinstall:: ${DESTDIR}${INCSDIR}/$I + +.PRECIOUS: ${DESTDIR}${INCSDIR}/$I +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${INCSDIR}/$I +.endif +${DESTDIR}${INCSDIR}/$I: ${DESTDIR}${INCSDIR} $I + @cmp -s $I ${.TARGET} > /dev/null 2>&1 || \ + (echo "${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} \ + -g ${BINGRP} -m ${NONBINMODE} $I ${.TARGET}" && \ + ${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} $I ${.TARGET}) +.endfor +.endif + +.endif # not symlinks + +.if defined(SYMLINKS) && !empty(SYMLINKS) +incinstall:: + @set ${SYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; \ + shift; \ + t=${DESTDIR}$$1; \ + shift; \ + echo ".include "; \ + echo "all:: $$t"; \ + echo ".PHONY: $$t"; \ + echo "$$t:"; \ + echo " @echo \"$$t -> $$l\""; \ + echo " @rm -rf $$t"; \ + echo " @ln -s $$l $$t"; \ + done | ${MAKE} -f- +.endif + +.if !target(incinstall) +incinstall:: +.endif + +.include diff --git a/pmake.hack/bsd.kmod.mk b/pmake.hack/bsd.kmod.mk new file mode 100644 index 0000000..e740c0e --- /dev/null +++ b/pmake.hack/bsd.kmod.mk @@ -0,0 +1,95 @@ +# $NetBSD: bsd.kmod.mk,v 1.30 1999/03/10 06:34:19 ross Exp $ + +.if !target(__initialized__) +__initialized__: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif +.include +.include +.MAIN: all +.endif + +.PHONY: cleankmod kmodinstall load unload +realinstall: kmodinstall +clean cleandir distclean: cleankmod + +S?= /sys +KERN= $S/kern + +CFLAGS+= ${COPTS} -D_KERNEL -D_LKM -I. -I${.CURDIR} -I$S -I$S/arch + +DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c} +CLEANFILES+= ${DPSRCS} +.if defined(YHEADER) +CLEANFILES+= ${SRCS:M*.y:.y=.h} +.endif + +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} + +.if !defined(PROG) +PROG= ${KMOD}.o +.endif + +${PROG}: ${DPSRCS} ${OBJS} ${DPADD} + ${LD} -r ${LDFLAGS} -o tmp.o ${OBJS} + mv tmp.o ${.TARGET} + +.if !defined(MAN) +MAN= ${KMOD}.4 +.endif + +all: machine-links ${PROG} + +.PHONY: machine-links +beforedepend: machine-links +machine-links: + -rm -f machine && \ + ln -s $S/arch/${MACHINE}/include machine + -rm -f ${MACHINE_ARCH} && \ + ln -s $S/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH} +CLEANFILES+=machine ${MACHINE_ARCH} + +cleankmod: + rm -f a.out [Ee]rrs mklog core *.core \ + ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES} + +# +# define various install targets +# +.if !target(kmodinstall) +kmodinstall:: ${DESTDIR}${KMODDIR}/${PROG} +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${KMODDIR}/${PROG} +.endif +.if !defined(BUILD) +${DESTDIR}${KMODDIR}/${PROG}: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${KMODDIR}/${PROG} +${DESTDIR}${KMODDIR}/${PROG}: ${PROG} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${KMODOWN} -g ${KMODGRP} \ + -m ${KMODMODE} ${.ALLSRC} ${.TARGET} +.endif + +lint: ${LOBJS} +.if defined(LOBJS) && !empty(LOBJS) + ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD} +.endif + +.if !target(load) +load: ${PROG} + /sbin/modload -o ${KMOD} -e${KMOD}_lkmentry ${PROG} +.endif + +.if !target(unload) +unload: ${PROG} + /sbin/modunload -n ${KMOD} +.endif + +.include +.include +.include +.include + +.-include "machine/Makefile.inc" diff --git a/pmake.hack/bsd.lib.mk b/pmake.hack/bsd.lib.mk new file mode 100644 index 0000000..4f1703d --- /dev/null +++ b/pmake.hack/bsd.lib.mk @@ -0,0 +1,396 @@ +# $NetBSD: bsd.lib.mk,v 1.152 1999/03/30 09:30:43 fair Exp $ +# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 + +.if !target(__initialized__) +__initialized__: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif +.include +.include +.MAIN: all +.endif + +.PHONY: checkver cleanlib libinstall +realinstall: checkver libinstall +clean cleandir distclean: cleanlib + +.if exists(${.CURDIR}/shlib_version) +SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major +SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor + +# Check for higher installed library versions. +.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \ + exists(${BSDSRCDIR}/lib/checkver) +checkver: + @(cd ${.CURDIR} && \ + ${BSDSRCDIR}/lib/checkver -d ${DESTDIR}${LIBDIR} ${LIB}) +.else +checkver: +.endif +.else +checkver: +.endif + +# add additional suffixes not exported. +# .po is used for profiling object files. +# .so is used for PIC object files. +.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h +.SUFFIXES: .sh .m4 .m + + +# Set PICFLAGS to cc flags for producing position-independent code, +# if not already set. Includes -DPIC, if required. + +# Data-driven table using make variables to control how shared libraries +# are built for different platforms and object formats. +# OBJECT_FMT: currently either "ELF" or "a.out", from +# SHLIB_SOVERSION: version number to be compiled into a shared library +# via -soname. Usualy ${SHLIB_MAJOR} on ELF. +# NetBSD/pmax used to use ${SHLIB_MAJOR}.{SHLIB-MINOR}. +# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library. +# with ELF, also set shared-lib version for ld.so. +# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors +# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors +# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS} +# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects. +# CAPICFLAGS flags for {$CC} to compiling .[Ss] files +# (usually just ${CPPPICFLAGS} ${CPICFLAGS}) +# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects. + +.if ${MACHINE_ARCH} == "alpha" + # Alpha-specific shared library flags +CPICFLAGS ?= -fpic -DPIC +CPPPICFLAGS?= -DPIC +CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} +APICFLAGS ?= +.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" + # mips-specific shared library flags + +# On mips, all libs need to be compiled with ABIcalls, not just sharedlibs. +CPICFLAGS?= +APICFLAGS?= +#CPICFLAGS?= -fpic -DPIC +#APICFLAGS?= -DPIC + +# so turn shlib PIC flags on for ${CPP}, ${CC}, and ${AS} as follows: +AINC+=-DPIC -DABICALLS +COPTS+= -fPIC ${AINC} +AFLAGS+= -fPIC +AS+= -KPIC + +.elif ${MACHINE_ARCH} == "sparc" && ${OBJECT_FMT} == "ELF" + +CPICFLAGS ?= -fpic -DPIC +CPPPICFLAGS?= -DPIC +CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} +APICFLAGS ?= -KPIC + +.elif (${MACHINE} == "debian") + +SHLIB_TYPE=ELF +SHLIB_LDSTARTFILE= +SHLIB_LDENDFILE= +SHLIB_SOVERSION=${SHLIB_MAJOR} +CPICFLAGS ?= -fPIC -DPIC +CPPPICFLAGS?= -DPIC +CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} +APICFLAGS ?= + +.else + +# Platform-independent flags for NetBSD a.out shared libraries (and PowerPC) +SHLIB_LDSTARTFILE= +SHLIB_LDENDFILE= +SHLIB_SHFLAGS= +SHLIB_SOVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} +CPICFLAGS?= -fpic -DPIC +CPPPICFLAGS?= -DPIC +CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} +APICFLAGS?= -k + +.endif + +# Platform-independent linker flags for ELF shared libraries +.if ${OBJECT_FMT} == "ELF" +SHLIB_SOVERSION=${SHLIB_MAJOR} +SHLIB_SHFLAGS=-soname lib${LIB}.so.${SHLIB_SOVERSION} +SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib64/crtbeginS.o +SHLIB_LDENDFILE= ${DESTDIR}/usr/lib64/crtendS.o +.endif + +CFLAGS+= ${COPTS} + +.c.o: + @echo ${COMPILE.c:Q} ${.IMPSRC} + @${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.c.po: + @echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET} + @${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.c.so: + @echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} + @${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.c.ln: + ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} + +.cc.o .C.o: + @echo ${COMPILE.cc:Q} ${.IMPSRC} + @${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.cc.po .C.po: + @echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET} + @${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.cc.so .C.so: + @echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} + @${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.m.o: + @echo ${COMPILE.m:Q} ${.IMPSRC} + @${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.m.po: + @echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET} + @${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.m.so: + @echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} + @${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.S.o .s.o: + @echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} + @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.S.po .s.po: + @echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} + @${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.S.so .s.so: + @echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} + @${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \ + || ${MKLINKLIB} != "no" +_LIBS=lib${LIB}.a +.else +_LIBS= +.endif + +.if ${MKPROFILE} != "no" +_LIBS+=lib${LIB}_p.a +.endif + +.if ${MKPIC} != "no" +_LIBS+=lib${LIB}_pic.a +.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR) +_LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} +.endif +.endif + +.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" +_LIBS+=llib-l${LIB}.ln +.endif + +all: ${SRCS} ${_LIBS} + +__archivebuild: .USE + @rm -f ${.TARGET} + @${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` + ${RANLIB} ${.TARGET} + +__archiveinstall: .USE + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN} -g ${LIBGRP} \ + -m 600 ${.ALLSRC} ${.TARGET} + ${RANLIB} -t ${.TARGET} + chmod ${LIBMODE} ${.TARGET} + +DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c} +CLEANFILES+= ${DPSRCS} +.if defined(YHEADER) +CLEANFILES+= ${SRCS:M*.y:.y=.h} +.endif + +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} +lib${LIB}.a:: ${OBJS} __archivebuild + @echo building standard ${LIB} library + +POBJS+= ${OBJS:.o=.po} +lib${LIB}_p.a:: ${POBJS} __archivebuild + @echo building profiled ${LIB} library + +SOBJS+= ${OBJS:.o=.so} +lib${LIB}_pic.a:: ${SOBJS} __archivebuild + @echo building shared object ${LIB} library + +lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD} \ + ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} + @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\) + @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} +.if defined(DESTDIR) + $(CC) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \ + ${SHLIB_LDSTARTFILE} \ + --whole-archive lib${LIB}_pic.a \ + -nostdlib -L${DESTDIR}${LIBDIR} -R${LIBDIR} \ + --no-whole-archive ${LDADD} \ + ${SHLIB_LDENDFILE} +.else + $(CC) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \ + ${SHLIB_LDSTARTFILE} \ + --whole-archive lib${LIB}_pic.a --no-whole-archive ${LDADD} \ + ${SHLIB_LDENDFILE} +.endif +.if ${OBJECT_FMT} == "ELF" + rm -f lib${LIB}.so.${SHLIB_MAJOR} + ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ + lib${LIB}.so.${SHLIB_MAJOR} + rm -f lib${LIB}.so + ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ + lib${LIB}.so +.endif + +LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} +LLIBS?= -lc +llib-l${LIB}.ln: ${LOBJS} + @echo building llib-l${LIB}.ln + @rm -f llib-l${LIB}.ln + @${LINT} -C${LIB} ${.ALLSRC} ${LLIBS} + +cleanlib: + rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES} + rm -f lib${LIB}.a ${OBJS} + rm -f lib${LIB}_p.a ${POBJS} + rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS} + rm -f llib-l${LIB}.ln ${LOBJS} + +.if defined(SRCS) +afterdepend: .depend + @(TMP=/tmp/_depend$$$$; \ + sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \ + < .depend > $$TMP; \ + mv $$TMP .depend) +.endif + +.if !target(libinstall) +# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no +libinstall:: + +.if ${MKLINKLIB} != "no" +libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a +.endif +.if !defined(BUILD) +${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a +${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall +.endif + +.if ${MKPROFILE} != "no" +libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a +.endif +.if !defined(BUILD) +${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a +${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall +.endif + +.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no" +libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a +.endif +.if !defined(BUILD) +${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a +${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall +.endif + +.if ${MKPIC} != "no" && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR) +libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} +.endif +.if !defined(BUILD) +${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} +${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN} -g ${LIBGRP} \ + -m ${LIBMODE} ${.ALLSRC} ${.TARGET} +.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR) + /sbin/ldconfig -m ${LIBDIR} +.endif +.if ${OBJECT_FMT} == "ELF" + rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR} + ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ + ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR} + rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so +.if ${MKLINKLIB} != "no" + ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ + ${DESTDIR}${LIBDIR}/lib${LIB}.so +.endif +.endif +.endif + +.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" +libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln +.endif +.if !defined(BUILD) +${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln +${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN} -g ${LIBGRP} \ + -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR} +.endif +.endif + +.include +.include +.include +.include +.include +.include +.include + +# Make sure all of the standard targets are defined, even if they do nothing. +lint regress: diff --git a/pmake.hack/bsd.links.mk b/pmake.hack/bsd.links.mk new file mode 100644 index 0000000..e377574 --- /dev/null +++ b/pmake.hack/bsd.links.mk @@ -0,0 +1,43 @@ +# $NetBSD: bsd.links.mk,v 1.8 1998/12/31 15:28:52 castor Exp $ + +.PHONY: linksinstall +realinstall: linksinstall + +.if defined(SYMLINKS) && !empty(SYMLINKS) +linksinstall:: + @set ${SYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; \ + shift; \ + t=${DESTDIR}$$1; \ + shift; \ + echo ".include "; \ + echo "all:: $$t"; \ + echo ".PHONY: $$t"; \ + echo "$$t:"; \ + echo " @echo \"$$t -> $$l\""; \ + echo " @rm -f $$t"; \ + echo " @ln -s $$l $$t"; \ + done | ${MAKE} -f- +.endif +.if defined(LINKS) && !empty(LINKS) +linksinstall:: + @set ${LINKS}; \ + while test $$# -ge 2; do \ + l=${DESTDIR}$$1; \ + shift; \ + t=${DESTDIR}$$1; \ + shift; \ + echo ".include "; \ + echo "all:: $$t"; \ + echo ".PHONY: $$t"; \ + echo "$$t:"; \ + echo " @echo \"$$t -> $$l\""; \ + echo " @rm -f $$t"; \ + echo " @ln $$l $$t"; \ + done | ${MAKE} -f- +.endif + +.if !target(linksinstall) +linksinstall: +.endif diff --git a/pmake.hack/bsd.man.mk b/pmake.hack/bsd.man.mk new file mode 100644 index 0000000..532ddf1 --- /dev/null +++ b/pmake.hack/bsd.man.mk @@ -0,0 +1,156 @@ +# $NetBSD: bsd.man.mk,v 1.45 1999/02/13 16:34:39 christos Exp $ +# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93 + +.if !target(__initialized__) +__initialized__: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif +.include +.include +.MAIN: all +.endif + +.PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman +.if ${MKMAN} != "no" +realinstall: ${MANINSTALL} +.endif +cleandir distclean: cleanman + +MANTARGET?= cat +NROFF?= nroff +TBL?= tbl + +.SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \ + .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 + +.9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: +.if !defined(USETBL) + @echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}" + @${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \ + (rm -f ${.TARGET}; false) +.else + @echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}" + @${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \ + (rm -f ${.TARGET}; false) +.endif + +.if defined(MAN) && !empty(MAN) +MANPAGES= ${MAN} +CATPAGES= ${MANPAGES:C/(.*).([1-9])/\1.cat\2/} +.endif + +MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${MANOWN} \ + -g ${MANGRP} -m ${MANMODE} + +.if defined(MANZ) +# chown and chmod are done afterward automatically +MCOMPRESS= gzip -9cf +MCOMPRESSSUFFIX= .gz +.endif + +catinstall: catlinks +maninstall: manlinks + +__installpage: .USE +.if defined(MCOMPRESS) && !empty(MCOMPRESS) + @rm -f ${.TARGET} + ${MCOMPRESS} ${.ALLSRC} > ${.TARGET} + @chown ${MANOWN}:${MANGRP} ${.TARGET} + @chmod ${MANMODE} ${.TARGET} +.else + ${MINSTALL} ${.ALLSRC} ${.TARGET} +.endif + + +# Rules for cat'ed man page installation +.if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no" +. for P in ${CATPAGES} +catpages:: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX} + +. if !defined(UPDATE) +.PHONY: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX} +. endif +. if !defined(BUILD) +${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE +. endif + +.PRECIOUS: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX} +${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage +. endfor +.else +catpages:: +.endif + +# Rules for source page installation +.if defined(MANPAGES) && !empty(MANPAGES) +. for P in ${MANPAGES} +manpages:: ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX} +. if !defined(UPDATE) +.PHONY: ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX} +. endif + +.PRECIOUS: ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX} +${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage +. endfor +.else +manpages:: +.endif + +.if ${MKCATPAGES} != "no" +catlinks: catpages +.if defined(MLINKS) && !empty(MLINKS) + @set ${MLINKS}; \ + while test $$# -ge 2; do \ + name=$$1; \ + shift; \ + dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ + l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ + name=$$1; \ + shift; \ + dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ + t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ + if [ -z "${UPDATE}" -o ! -f $$t ]; then \ + echo $$t -\> $$l; \ + ln -sf $$l $$t; \ + fi; \ + done +.endif +.else +catlinks: +.endif + +manlinks: manpages +.if defined(MLINKS) && !empty(MLINKS) + @set ${MLINKS}; \ + while test $$# -ge 2; do \ + name=$$1; \ + shift; \ + dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ + l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ + name=$$1; \ + shift; \ + dir=${DESTDIR}${MANDIR}/man$${name##*.}; \ + t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \ + if [ -z "${UPDATE}" -o ! -f $$t ]; then \ + echo $$t -\> $$l; \ + ln -sf $$l $$t; \ + fi; \ + done +.endif + +.if defined(CATPAGES) +.if ${MKCATPAGES} != "no" && ${MKMAN} != "no" +all: ${CATPAGES} +.else +all: +.endif + +cleanman: + rm -f ${CATPAGES} +.else +cleanman: +.endif + +# Make sure all of the standard targets are defined, even if they do nothing. +clean depend includes lint regress tags: diff --git a/pmake.hack/bsd.nls.mk b/pmake.hack/bsd.nls.mk new file mode 100644 index 0000000..f0f6c7c --- /dev/null +++ b/pmake.hack/bsd.nls.mk @@ -0,0 +1,64 @@ +# $NetBSD: bsd.nls.mk,v 1.17 1999/02/12 12:38:45 lukem Exp $ + +.if !target(__initialized__) +__initialized__: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif + +.MAIN: all +.endif +.PHONY: cleannls nlsinstall +.if ${MKNLS} != "no" +realinstall: nlsinstall +.endif +cleandir distclean: cleannls + +.SUFFIXES: .cat .msg + +.msg.cat: + @rm -f ${.TARGET} + gencat ${.TARGET} ${.IMPSRC} + +.if defined(NLS) && !empty(NLS) +NLSALL= ${NLS:.msg=.cat} +.endif + +.if !defined(NLSNAME) +.if defined(PROG) +NLSNAME=${PROG} +.else +NLSNAME=lib${LIB} +.endif +.endif + +.if defined(NLSALL) +.if ${MKNLS} != "no" +all: ${NLSALL} +.endif + +cleannls: + rm -f ${NLSALL} + +.for F in ${NLSALL} +nlsinstall:: ${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat +.endif +.if !defined(BUILD) +${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat +${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat: ${F} + ${INSTALL} -d ${.TARGET:H} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${NLSOWN} -g ${NLSGRP} \ + -m ${NLSMODE} ${.ALLSRC} ${.TARGET} +.endfor +.else +cleannls: +.endif + +.if !target(nlsinstall) +nlsinstall:: +.endif diff --git a/pmake.hack/bsd.obj.mk b/pmake.hack/bsd.obj.mk new file mode 100644 index 0000000..8cc1b8a --- /dev/null +++ b/pmake.hack/bsd.obj.mk @@ -0,0 +1,54 @@ +# $NetBSD: bsd.obj.mk,v 1.17 1999/02/12 04:13:26 lukem Exp $ + +.if !target(__initialized_obj__) +__initialized_obj__: +.include +.endif + +.if ${MKOBJ} == "no" +obj: +.else + +.if defined(OBJMACHINE) +__objdir= obj.${MACHINE} +.else +__objdir= obj +.endif + +.if defined(USR_OBJMACHINE) +__usrobjdir= ${BSDOBJDIR}.${MACHINE} +__usrobjdirpf= +.else +__usrobjdir= ${BSDOBJDIR} +.if defined(OBJMACHINE) +__usrobjdirpf= .${MACHINE} +.else +__usrobjdirpf= +.endif +.endif + +obj: + @cd ${.CURDIR}; rm -f ${__objdir} > /dev/null 2>&1 || true; \ + here=`/bin/pwd`; subdir=$${here#${BSDSRCDIR}/}; \ + if test $$here != $$subdir ; then \ + dest=${__usrobjdir}/$$subdir${__usrobjdirpf} ; \ + echo "$$here/${__objdir} -> $$dest"; \ + rm -rf ${__objdir}; \ + ln -s $$dest ${__objdir}; \ + if test -d ${__usrobjdir} -a ! -d $$dest; then \ + mkdir -p $$dest; \ + else \ + true; \ + fi; \ + else \ + true ; \ + dest=$$here/${__objdir} ; \ + if test ! -d ${__objdir} ; then \ + echo "making $$dest" ; \ + mkdir $$dest; \ + fi ; \ + fi; +.endif + +print-objdir: + @echo ${.OBJDIR} diff --git a/pmake.hack/bsd.own.mk b/pmake.hack/bsd.own.mk new file mode 100644 index 0000000..8ab9e9a --- /dev/null +++ b/pmake.hack/bsd.own.mk @@ -0,0 +1,257 @@ +# $NetBSD: bsd.own.mk,v 1.120 1999/02/24 14:42:36 drochner Exp $ + +.if !defined(_BSD_OWN_MK_) +_BSD_OWN_MK_=1 + +.if defined(MAKECONF) && exists(${MAKECONF}) +.include "${MAKECONF}" +.elif exists(/etc/mk.conf) +.include "/etc/mk.conf" +.endif + +# Defining `SKEY' causes support for S/key authentication to be compiled in. +SKEY= yes +# Defining `KERBEROS' causes support for Kerberos authentication to be +# compiled in. +#KERBEROS= yes +# Defining 'KERBEROS5' causes support for Kerberos5 authentication to be +# compiled in. +#KERBEROS5= yes + +# where the system object and source trees are kept; can be configurable +# by the user in case they want them in ~/foosrc and ~/fooobj, for example +BSDSRCDIR?= /usr/src +BSDOBJDIR?= /usr/obj + +BINGRP?= root +BINOWN?= root +BINMODE?= 755 +NONBINMODE?= 644 + +# Define MANZ to have the man pages compressed (gzip) +MANZ= 1 + +MANDIR?= /usr/share/man +MANGRP?= root +MANOWN?= root +MANMODE?= ${NONBINMODE} +MANINSTALL?= maninstall catinstall + +INFODIR?= /usr/share/info +INFOGRP?= root +INFOOWN?= root +INFOMODE?= ${NONBINMODE} + +LIBDIR?= /usr/lib +LINTLIBDIR?= /usr/libdata/lint +LIBGRP?= ${BINGRP} +LIBOWN?= ${BINOWN} +LIBMODE?= ${NONBINMODE} + +DOCDIR?= /usr/share/doc +DOCGRP?= root +DOCOWN?= root +DOCMODE?= ${NONBINMODE} + +NLSDIR?= /usr/share/nls +NLSGRP?= root +NLSOWN?= root +NLSMODE?= ${NONBINMODE} + +KMODDIR?= /usr/lkm +KMODGRP?= root +KMODOWN?= root +KMODMODE?= ${NONBINMODE} + +COPY?= -c +.if defined(UPDATE) +PRESERVE?= -p +.else +PRESERVE?= +.endif +RENAME?= +STRIPFLAG?= -s + +# Define SYS_INCLUDE to indicate whether you want symbolic links to the system +# source (``symlinks''), or a separate copy (``copies''); (latter useful +# in environments where it's not possible to keep /sys publicly readable) +#SYS_INCLUDE= symlinks + +# XXX The next two are temporary until the transition to UVM is complete. + +# Systems on which UVM is the standard VM system. +.if ${MACHINE} != "pica" +UVM?= yes +.endif + +# Systems that use UVM's new pmap interface. +.if ${MACHINE} == "alpha" || \ + ${MACHINE} == "i386" || \ + ${MACHINE} == "pc532" || \ + ${MACHINE} == "vax" +PMAP_NEW?= yes +.endif + +# The sparc64 port is incomplete. +.if ${MACHINE_ARCH} == "sparc64" +NOPROFILE=1 +NOPIC=1 +NOLINT=1 +.endif + +# The PowerPC port is incomplete. +.if ${MACHINE_ARCH} == "powerpc" +NOPROFILE= +.endif + +# Data-driven table using make variables to control how +# toolchain-dependent targets and shared libraries are built +# for different platforms and object formats. +# OBJECT_FMT: currently either "ELF" or "a.out". +# SHLIB_TYPE: "ELF" or "a.out" or "" to force static libraries. +# +#.if ${MACHINE_ARCH} == "alpha" || \ +# ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ +# ${MACHINE_ARCH} == "powerpc" || \ +# ${MACHINE_ARCH} == "sparc64" +#OBJECT_FMT?=ELF +#.else + +# On Debian GNU/Linux, Everything is ELF. +OBJECT_FMT?=a.out +#.endif + +# GNU sources and packages sometimes see architecture names differently. +# This table maps an architecture name to its GNU counterpart. +# Use as so: ${GNU_ARCH.${TARGET_ARCH}} or ${MACHINE_GNU_ARCH} +GNU_ARCH.alpha=alpha +GNU_ARCH.arm32=arm +GNU_ARCH.i386=i386 +GNU_ARCH.m68k=m68k +GNU_ARCH.mipseb=mipseb +GNU_ARCH.mipsel=mipsel +GNU_ARCH.ns32k=ns32k +GNU_ARCH.powerpc=powerpc +GNU_ARCH.sparc=sparc +GNU_ARCH.sparc64=sparc +GNU_ARCH.vax=vax +.if ${MACHINE_ARCH} == "mips" +.INIT: + @echo Must set MACHINE_ARCH to one of mipseb or mipsel + @false +.endif + +.if ${MACHINE_ARCH} == "sparc64" +MACHINE_GNU_ARCH=${MACHINE_ARCH} +.else +MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}} +.endif + +TARGETS+= all clean cleandir depend distclean includes install lint obj \ + regress tags +.PHONY: all clean cleandir depend distclean includes install lint obj \ + regress tags beforedepend afterdepend beforeinstall \ + afterinstall realinstall + +# set NEED_OWN_INSTALL_TARGET, if it's not already set, to yes +# this is used by bsd.pkg.mk to stop "install" being defined +NEED_OWN_INSTALL_TARGET?= yes + +.if ${NEED_OWN_INSTALL_TARGET} == "yes" +.if !target(install) +install: .NOTMAIN beforeinstall subdir-install realinstall afterinstall +beforeinstall: .NOTMAIN +subdir-install: .NOTMAIN beforeinstall +realinstall: .NOTMAIN beforeinstall +afterinstall: .NOTMAIN subdir-install realinstall +.endif +.endif + +# Define MKxxx variables (which are either yes or no) for users +# to set in /etc/mk.conf and override on the make commandline. +# These should be tested with `== "no"' or `!= "no"'. +# The NOxxx variables should only be used by Makefiles. +# + +MKCATPAGES?=no + +.if defined(NODOC) +MKDOC=no +#.elif !defined(MKDOC) +#MKDOC=yes +.else +MKDOC?=yes +.endif + +MKINFO?=yes + +.if defined(NOLINKLIB) +MKLINKLIB=no +.else +MKLINKLIB?=yes +.endif +.if ${MKLINKLIB} == "no" +MKPICINSTALL=no +MKPROFILE=no +.endif + +.if defined(NOLINT) +MKLINT=no +.else +MKLINT?=yes +.endif + +.if defined(NOMAN) +MKMAN=no +.else +MKMAN?=yes +.endif +.if ${MKMAN} == "no" +MKCATPAGES=no +.endif + +.if defined(NONLS) +MKNLS=no +.else +MKNLS?=yes +.endif + +.if defined(NOOBJ) +MKOBJ=no +.else +MKOBJ?=yes +.endif + +.if defined(NOPIC) +MKPIC=no +.else +MKPIC?=yes +.endif + +.if defined(NOPICINSTALL) +MKPICINSTALL=no +.else +MKPICINSTALL?=yes +.endif + +.if defined(NOPROFILE) +MKPROFILE=no +.else +MKPROFILE?=yes +.endif + +.if defined(NOSHARE) +MKSHARE=no +.else +MKSHARE?=yes +.endif +.if ${MKSHARE} == "no" +MKCATPAGES=no +MKDOC=no +MKINFO=no +MKMAN=no +MKNLS=no +.endif + + +.endif # _BSD_OWN_MK_ diff --git a/pmake.hack/bsd.prog.mk b/pmake.hack/bsd.prog.mk new file mode 100644 index 0000000..d0c86ba --- /dev/null +++ b/pmake.hack/bsd.prog.mk @@ -0,0 +1,202 @@ +# $NetBSD: bsd.prog.mk,v 1.100 1999/02/12 01:10:08 lukem Exp $ +# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 + +.if !target(__initialized__) +__initialized__: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif +.include +.include +.MAIN: all +.endif + +.PHONY: cleanprog proginstall scriptsinstall +realinstall: proginstall scriptsinstall +clean cleandir distclean: cleanprog + +CFLAGS+= ${COPTS} + +# ELF platforms depend on crtbegin.o and crtend.o +.if ${OBJECT_FMT} == "ELF" +LIBCRTBEGIN?= ${DESTDIR}/usr/lib64/crtbegin.o +LIBCRTEND?= ${DESTDIR}/usr/lib64/crtend.o +.else +LIBCRTBEGIN?= +LIBCRTEND?= +.endif + +LIBCRT0?= + +LIBBZ2?= ${DESTDIR}/usr/lib64/libbz2.a +LIBC?= ${DESTDIR}/usr/lib64/libc.a +LIBC_PIC?= ${DESTDIR}/usr/lib64/libc_pic.a +LIBCOMPAT?= ${DESTDIR}/usr/lib64/libcompat.a +LIBCRYPT?= ${DESTDIR}/usr/lib64/libcrypt.a +LIBCURSES?= ${DESTDIR}/usr/lib64/libcurses.a +LIBDBM?= ${DESTDIR}/usr/lib64/libdbm.a +LIBDES?= ${DESTDIR}/usr/lib64/libdes.a +LIBEDIT?= ${DESTDIR}/usr/lib64/libedit.a +LIBGCC?= ${DESTDIR}/usr/lib64/libgcc.a +LIBGNUMALLOC?= ${DESTDIR}/usr/lib64/libgnumalloc.a +LIBKDB?= ${DESTDIR}/usr/lib64/libkdb.a +LIBKRB?= ${DESTDIR}/usr/lib64/libkrb.a +LIBKVM?= ${DESTDIR}/usr/lib64/libkvm.a +LIBL?= ${DESTDIR}/usr/lib64/libl.a +LIBM?= ${DESTDIR}/usr/lib64/libm.a +LIBMP?= ${DESTDIR}/usr/lib64/libmp.a +LIBNTP?= ${DESTDIR}/usr/lib64/libntp.a +LIBOBJC?= ${DESTDIR}/usr/lib64/libobjc.a +LIBPC?= ${DESTDIR}/usr/lib64/libpc.a +LIBPCAP?= ${DESTDIR}/usr/lib64/libpcap.a +LIBPLOT?= ${DESTDIR}/usr/lib64/libplot.a +LIBPOSIX?= ${DESTDIR}/usr/lib64/libposix.a +LIBRESOLV?= ${DESTDIR}/usr/lib64/libresolv.a +LIBRPCSVC?= ${DESTDIR}/usr/lib64/librpcsvc.a +LIBSKEY?= ${DESTDIR}/usr/lib64/libskey.a +LIBTERMCAP?= ${DESTDIR}/usr/lib64/libtermcap.a +LIBTELNET?= ${DESTDIR}/usr/lib64/libtelnet.a +LIBUTIL?= ${DESTDIR}/usr/lib64/libutil.a +LIBWRAP?= ${DESTDIR}/usr/lib64/libwrap.a +LIBY?= ${DESTDIR}/usr/lib64/liby.a +LIBZ?= ${DESTDIR}/usr/lib64/libz.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 + +.cc.o: + ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c - + @mv -f x.c x.cc + @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET} + @rm -f x.cc + +.C.o: + ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c - + @mv -f x.c x.C + @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET} + @rm -f x.C +.endif + + +.if defined(PROG) +SRCS?= ${PROG}.c + +DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c} +CLEANFILES+= ${DPSRCS} +.if defined(YHEADER) +CLEANFILES+= ${SRCS:M*.y:.y=.h} +.endif + +.if !empty(SRCS:N*.h:N*.sh) +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} +LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} +.endif + +.if defined(OBJS) && !empty(OBJS) +.NOPATH: ${OBJS} +.if defined(DESTDIR) + +${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD} + ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -lgcc -lc -lgcc ${LIBCRTEND} + +.else + +${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD} + ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} + +.endif # defined(DESTDIR) +.endif # defined(OBJS) && !empty(OBJS) + +.if !defined(MAN) +MAN= ${PROG}.1 +.endif # !defined(MAN) +.endif # defined(PROG) + +all: ${PROG} + +cleanprog: + rm -f a.out [Ee]rrs mklog core *.core \ + ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES} + +.if defined(SRCS) +afterdepend: .depend + @(TMP=/tmp/_depend$$$$; \ + sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \ + < .depend > $$TMP; \ + mv $$TMP .depend) +.endif + +.if defined(PROG) && !target(proginstall) +PROGNAME?= ${PROG} +proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME} +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${BINDIR}/${PROGNAME} +.endif +.if !defined(BUILD) +${DESTDIR}${BINDIR}/${PROGNAME}: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME} +${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${STRIPFLAG} -o ${BINOWN} \ + -g ${BINGRP} -m ${BINMODE} ${.ALLSRC} ${.TARGET} +.endif + +.if !target(proginstall) +proginstall:: +.endif + +.if defined(SCRIPTS) && !target(scriptsinstall) +SCRIPTSDIR?=${BINDIR} +SCRIPTSOWN?=${BINOWN} +SCRIPTSGRP?=${BINGRP} +SCRIPTSMODE?=${BINMODE} +.for S in ${SCRIPTS} +SCRIPTSDIR_${S}?=${SCRIPTSDIR} +SCRIPTSOWN_${S}?=${SCRIPTSOWN} +SCRIPTSGRP_${S}?=${SCRIPTSGRP} +SCRIPTSMODE_${S}?=${SCRIPTSMODE} +.if defined(SCRIPTSNAME) +SCRIPTSNAME_${S} ?= ${SCRIPTSNAME} +.else +SCRIPTSNAME_${S} ?= ${S:T:R} +.endif +SCRIPTSDIR_${S} ?= ${SCRIPTSDIR} +scriptsinstall:: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}} +.if !defined(UPDATE) +.PHONY: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}} +.endif +.if !defined(BUILD) +${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: .MADE +.endif + +.PRECIOUS: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}} +${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: ${S} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${SCRIPTSOWN_${S}} -g \ + ${SCRIPTSGRP_${S}} -m ${SCRIPTSMODE_${S}} ${.ALLSRC} ${.TARGET} +.endfor +.endif + +.if !target(scriptsinstall) +scriptsinstall:: +.endif + +lint: ${LOBJS} +.if defined(LOBJS) && !empty(LOBJS) + ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD} +.endif + +.include +.include +.include +.include +.include +.include +.include + +# Make sure all of the standard targets are defined, even if they do nothing. +regress: diff --git a/pmake.hack/bsd.subdir.mk b/pmake.hack/bsd.subdir.mk new file mode 100644 index 0000000..cb91fdb --- /dev/null +++ b/pmake.hack/bsd.subdir.mk @@ -0,0 +1,34 @@ +# $NetBSD: bsd.subdir.mk,v 1.31 1999/02/11 05:01:39 tv Exp $ +# @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93 + +.if !target(__initialized__) +__initialized__: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif +.include +.MAIN: all +.endif + +.for dir in ${SUBDIR} +.if exists(${dir}.${MACHINE}) +__REALSUBDIR+=${dir}.${MACHINE} +.else +__REALSUBDIR+=${dir} +.endif +.endfor + +.for dir in ${__REALSUBDIR} +.for targ in ${TARGETS} +.PHONY: ${targ}-${dir} +${targ}-${dir}: .MAKE + @echo "${targ} ===> ${_THISDIR_}${dir}" + @cd ${.CURDIR}/${dir}; \ + ${MAKE} "_THISDIR_=${_THISDIR_}${dir}/" ${targ} +subdir-${targ}: ${targ}-${dir} +${targ}: subdir-${targ} +.endfor +.endfor + +# Make sure all of the standard targets are defined, even if they do nothing. +${TARGETS}: diff --git a/pmake.hack/bsd.sys.mk b/pmake.hack/bsd.sys.mk new file mode 100644 index 0000000..d63f7b1 --- /dev/null +++ b/pmake.hack/bsd.sys.mk @@ -0,0 +1,110 @@ +# $NetBSD: bsd.sys.mk,v 1.34 1999/01/31 09:17:20 mrg Exp $ +# +# Overrides used for NetBSD source tree builds. + +.if defined(WARNS) && ${WARNS} == 1 +CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith +.endif +.if !defined(NOGCCERROR) +CFLAGS+= -Werror +.endif +CFLAGS+= ${CWARNFLAGS} + +.if defined(DESTDIR) +CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include +LINTFLAGS+= -d ${DESTDIR}/usr/include +.endif + +.if defined(AUDIT) +CPPFLAGS+= -D__AUDIT__ +.endif + +# Helpers for cross-compiling +HOST_CC?= cc +HOST_CFLAGS?= -O +HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c +HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} + +HOST_CPP?= cpp +HOST_CPPFLAGS?= + +HOST_LD?= ld +HOST_LDFLAGS?= + +STRIPPROG?= strip + + +.SUFFIXES: .m .o .ln .lo + +# Objective C +# (Defined here rather than in because `.m' is not just +# used for Objective C source) +.m: + ${LINK.m} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.m.o: + ${COMPILE.m} ${.IMPSRC} + +# Host-compiled C objects +.c.lo: + ${HOST_COMPILE.c} -o ${.TARGET} ${.IMPSRC} + + +.if defined(PARALLEL) || defined(LPREFIX) +LPREFIX?=yy +LFLAGS+=-P${LPREFIX} +# Lex +.l: + ${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC} + ${LINK.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c ${LDLIBS} -ll + rm -f ${.TARGET:R}.${LPREFIX}.c +.l.c: + ${LEX.l} -o${.TARGET} ${.IMPSRC} +.l.o: + ${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC} + ${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c + rm -f ${.TARGET:R}.${LPREFIX}.c +.l.lo: + ${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC} + ${HOST_COMPILE.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c + rm -f ${.TARGET:R}.${LPREFIX}.c +.endif + +# Yacc +.if defined(YHEADER) || defined(YPREFIX) +.if defined(YPREFIX) +YFLAGS+=-p${YPREFIX} +.endif +.if defined(YHEADER) +YFLAGS+=-d +.endif +.y: + ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} + ${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS} + rm -f ${.TARGET:R}.tab.c ${.TARGET:R}.tab.h +.y.h: ${.TARGET:R}.c +.y.c: + ${YACC.y} -o ${.TARGET} ${.IMPSRC} +.y.o: + ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} + ${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c + rm -f ${.TARGET:R}.tab.c ${TARGET:R}.tab.h +.y.lo: + ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} + ${HOST_COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c + rm -f ${.TARGET:R}.tab.c ${TARGET:R}.tab.h +.elif defined(PARALLEL) +.y: + ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} + ${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS} + rm -f ${.TARGET:R}.tab.c +.y.c: + ${YACC.y} -o ${.TARGET} ${.IMPSRC} +.y.o: + ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} + ${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c + rm -f ${.TARGET:R}.tab.c +.y.lo: + ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} + ${HOST_COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c + rm -f ${.TARGET:R}.tab.c +.endif diff --git a/pmake.hack/sys.mk b/pmake.hack/sys.mk new file mode 100644 index 0000000..c6f4be7 --- /dev/null +++ b/pmake.hack/sys.mk @@ -0,0 +1,207 @@ +# $NetBSD: sys.mk,v 1.54 1999/03/10 14:06:14 mycroft Exp $ +# @(#)sys.mk 8.2 (Berkeley) 3/21/94 + +unix?= We run NetBSD. + +.SUFFIXES: .out .a .ln .o .s .S .c .cc .C .F .f .r .y .l .cl .p .h .sh .m4 + +.LIBS: .a + +AR?= ar +ARFLAGS?= rl +RANLIB?= ranlib + +AS?= as +AFLAGS?= +COMPILE.s?= ${CC} ${AFLAGS} -c +LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS} +COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp +LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS} + +CC?= cc +.if ${MACHINE_ARCH} == "alpha" || \ + ${MACHINE_ARCH} == "arm32" || \ + ${MACHINE_ARCH} == "i386" || \ + ${MACHINE_ARCH} == "m68k" || \ + ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ + ${MACHINE_ARCH} == "sparc" +CFLAGS?= -O2 +.else +CFLAGS?= -O +.endif +COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c +LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} + +CXX?= c++ +CXXFLAGS?= ${CFLAGS} +COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c +LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} + +OBJC?= ${CC} +OBJCFLAGS?= ${CFLAGS} +COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c +LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} + +CPP?= cpp +CPPFLAGS?= + +FC?= f77 +FFLAGS?= -O +RFLAGS?= +COMPILE.f?= ${FC} ${FFLAGS} -c +LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS} +COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c +LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} +COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c +LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} + +INSTALL?= install + +LEX?= lex +LFLAGS?= +LEX.l?= ${LEX} ${LFLAGS} + +LD?= ld +LDFLAGS?= + +LINT?= lint +LINTFLAGS?= -chapbxzF + +LORDER?= lorder + +MAKE?= pmake + +NM?= nm + +PC?= pc +PFLAGS?= +COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c +LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} + +SHELL?= sh + +SIZE?= size + +TSORT?= tsort + +YACC?= yacc +YFLAGS?= +YACC.y?= ${YACC} ${YFLAGS} + +# C +.c: + ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.c.o: + ${COMPILE.c} ${.IMPSRC} +.c.a: + ${COMPILE.c} ${.IMPSRC} + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o +.c.ln: + ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} + +# C++ +.cc: + ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.cc.o: + ${COMPILE.cc} ${.IMPSRC} +.cc.a: + ${COMPILE.cc} ${.IMPSRC} + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o + +.C: + ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.C.o: + ${COMPILE.cc} ${.IMPSRC} +.C.a: + ${COMPILE.cc} ${.IMPSRC} + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o + +# Fortran/Ratfor +.f: + ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.f.o: + ${COMPILE.f} ${.IMPSRC} +.f.a: + ${COMPILE.f} ${.IMPSRC} + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o + +.F: + ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.F.o: + ${COMPILE.F} ${.IMPSRC} +.F.a: + ${COMPILE.F} ${.IMPSRC} + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o + +.r: + ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.r.o: + ${COMPILE.r} ${.IMPSRC} +.r.a: + ${COMPILE.r} ${.IMPSRC} + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o + +# Pascal +.p: + ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.p.o: + ${COMPILE.p} ${.IMPSRC} +.p.a: + ${COMPILE.p} ${.IMPSRC} + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o + +# Assembly +.s: + ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.s.o: + ${COMPILE.s} ${.IMPSRC} +.s.a: + ${COMPILE.s} ${.IMPSRC} + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o +.S: + ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} +.S.o: + ${COMPILE.S} ${.IMPSRC} +.S.a: + ${COMPILE.S} ${.IMPSRC} + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o + +# Lex +.l: + ${LEX.l} ${.IMPSRC} + ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll + rm -f lex.yy.c +.l.c: + ${LEX.l} ${.IMPSRC} + mv lex.yy.c ${.TARGET} +.l.o: + ${LEX.l} ${.IMPSRC} + ${COMPILE.c} -o ${.TARGET} lex.yy.c + rm -f lex.yy.c + +# Yacc +.y: + ${YACC.y} ${.IMPSRC} + ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} + rm -f y.tab.c +.y.c: + ${YACC.y} ${.IMPSRC} + mv y.tab.c ${.TARGET} +.y.o: + ${YACC.y} ${.IMPSRC} + ${COMPILE.c} -o ${.TARGET} y.tab.c + rm -f y.tab.c + +# Shell +.sh: + rm -f ${.TARGET} + cp ${.IMPSRC} ${.TARGET} diff --git a/tetris/Makefile b/tetris/Makefile index 0d9c0d6..dcc05a8 100644 --- a/tetris/Makefile +++ b/tetris/Makefile @@ -4,7 +4,7 @@ PROG= tetris SRCS= input.c screen.c shapes.c scores.c tetris.c MAN= tetris.6 -DPADD= ${LIBTERMINFO} +DPADD= ${LIBCURSES} # 20150209 bkw: s/terminfo/curses/, add -lbsd LDADD=-lcurses -lbsd HIDEGAME=hidegame -- cgit v1.2.3