diff --git a/src/Makefile b/src/Makefile index 898354e..24e4fcc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,102 +1,555 @@ -# $Id: Makefile 148 2016-01-18 19:34:32Z reddawg $ -# The System Makefile (C) 2002 The UbixOS Project +# Variables: +# DESTDIR is the target directory for installation of the compiled +# software. It defaults to /. Note that programs are built against +# libraries installed in DESTDIR. +# MKMAN, if `no', will prevent building of manual pages. +# MKOBJDIRS, if not `no', will build object directories at +# an appropriate point in a build. +# MKSHARE, if `no', will prevent building and installing +# anything in /usr/share. +# MKUPDATE, if not `no', will avoid a `make cleandir' at the start of +# `make build', as well as having the effects listed in +# /usr/share/mk/ubix.README. +# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start +# of the `make build'. +# NOINCLUDES will avoid the `make includes' usually done by `make build'. +# +# +# Targets: +# build: +# Builds a full release of NetBSD in DESTDIR, except for the +# /etc configuration files. +# If BUILD_DONE is set, this is an empty target. +# distribution: +# Builds a full release of NetBSD in DESTDIR, including the /etc +# configuration files. +# buildworld: +# As per `make distribution', except that it ensures that DESTDIR +# is not the root directory. +# installworld: +# Install the distribution from DESTDIR to INSTALLWORLDDIR (which +# defaults to the root directory). Ensures that INSTALLWORLDDIR +# is not the root directory if cross compiling. +# release: +# Does a `make distribution', and then tars up the DESTDIR files +# into ${RELEASEDIR}/${RELEASEMACHINEDIR}, in release(7) format. +# (See etc/Makefile for more information on this.) +# regression-tests: +# Runs the regression tests in "regress" on this host. +# sets: +# Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets +# from ${DESTDIR} +# sourcesets: +# Populate ${RELEASEDIR}/source/sets from ${NETBSDSRCDIR} +# syspkgs: +# Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs +# from ${DESTDIR} +# iso-image: +# Create CD-ROM image in RELEASEDIR/images. +# RELEASEDIR must already have been populated by `make release' +# or equivalent. +# iso-image-source: +# Create CD-ROM image with source in RELEASEDIR/images. +# RELEASEDIR must already have been populated by +# `make release sourcesets' or equivalent. +# live-image: +# Create bootable live image for emulators or USB stick etc. +# in RELEASEDIR/liveimage. +# RELEASEDIR must already have been populated by `make release' +# or equivalent. +# install-image: +# Create bootable installation image for USB stick etc. +# in RELEASEDIR/installimage. +# RELEASEDIR must already have been populated by `make release' +# or equivalent. +# +# Targets invoked by `make build,' in order: +# cleandir: cleans the tree. +# do-top-obj: creates the top level object directory. +# do-tools-obj: creates object directories for the host toolchain. +# do-tools: builds host toolchain. +# params: record the values of variables that might affect the +# build. +# obj: creates object directories. +# do-distrib-dirs: creates the distribution directories. +# includes: installs include files. +# do-lib: builds and installs prerequisites from lib +# if ${MKCOMPAT} != "no". +# do-compat-lib: builds and installs prerequisites from compat/lib +# if ${MKCOMPAT} != "no". +# do-build: builds and installs the entire system. +# do-x11: builds and installs X11 if ${MKX11} != "no"; either +# X11R7 from src/external/mit/xorg +# do-extsrc: builds and installs extsrc if ${MKEXTSRC} != "no". +# do-obsolete: installs the obsolete sets (for the postinstall-* targets). +# -MAKE=make +.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == "" +.MAKEFLAGS: -m ${.CURDIR}/share/mk +.endif -CURDIR=${.CURDIR} +# +# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may +# not be the top level objdir, because "make obj" can happen in the *middle* +# of "make build" (long after is calculated it). So, pre-set +# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}. +# +_SRC_TOP_OBJ_= -OBJ_DIR?= ${CURDIR}/obj +.include -CLEANDIR=clean +# +# Sanity check: make sure that "make build" is not invoked simultaneously +# with a standard recursive target. +# -WORLD_LIB_SRC=${CURDIR}/lib -WORLD_BIN_SRC=${CURDIR}/bin -WORLD_INC=${CURDIR}/include.new -WORLD_FLAGS=_ARCH=${_ARCH} CC="cc" CXX="c++" AS="as" AR="ar" LD="ld" NM=nm OBJDUMP= OBJCOPY="objcopy" RANLIB=ranlib +.if make(build) || make(release) || make(snapshot) +.for targ in ${TARGETS:Nobj:Ncleandir} +.if make(${targ}) && !target(.BEGIN) +.BEGIN: + @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.' + @false +.endif +.endfor +.endif -WMAKE= ${MAKE} ${WORLD_FLAGS} INCLUDE=${WORLD_INC} BUILD_DIR=${CURDIR}/build +# +# _SUBDIR is used to set SUBDIR, after removing directories that have +# BUILD_${dir}=no, or that have no ${dir}/Makefile. +# +_SUBDIR= tools lib include gnu external crypto/external bin games +_SUBDIR+= libexec sbin usr.bin +_SUBDIR+= usr.sbin share sys etc tests compat +_SUBDIR+= .WAIT rescue .WAIT distrib regress +.if defined(__MINIX) +# the minix subdir depends on some other things (e.g. lib/) +_SUBDIR+= .WAIT minix +.endif # defined(__MINIX) -TMP_PATH=${PATH} -ROOT=/ubixos +.for dir in ${_SUBDIR} +.if "${dir}" == ".WAIT" \ + || (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile)) +SUBDIR+= ${dir} +.endif +.endfor -all: kernel world install-kernel install-world -# csu ubix_api libc_old libc ubix libcpp bin tools -# depend kernel tools +.if exists(regress) +regression-tests: .PHONY .MAKE + @echo Running regression tests... + ${MAKEDIRTARGET} regress regress +.endif -kernel: - @cd sys;make +.if ${MKUNPRIVED} != "no" +NOPOSTINSTALL= # defined +.endif -world: - @echo - @echo "***************************************************************" - @echo "World Build For ${_ARCH} Started On `LC_ALL=C date`" - @echo "***************************************************************" - @echo - @echo "***************************************************************" - @echo "Step 1: Clean World" - @echo "***************************************************************" - #cd ${WORLD_LIB_SRC}; ${WMAKE} ${CLEANDIR} - #cd ${WORLD_BIN_SRC}; ${WMAKE} ${CLEANDIR} - @echo - @echo "***************************************************************" - @echo "Step 2: Build World Libraries" - @echo "***************************************************************" - cd ${WORLD_LIB_SRC}; ${WMAKE} all - @echo - @echo "***************************************************************" - @echo "Step 3: Build World Binaries" - @echo "***************************************************************" - cd ${WORLD_BIN_SRC}; ${WMAKE} all - @echo - @echo "***************************************************************" - @echo "World Build For ${_ARCH} Completed On `LC_ALL=C date`" - @echo "***************************************************************" +afterinstall: .PHONY .MAKE +.if ${MKMAN} != "no" +.if !defined(__MINIX) + ${MAKEDIRTARGET} share/man makedb +.else + ${MAKEDIRTARGET} minix/man makedb +.endif # !defined(__MINIX) +.endif +.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no") + ${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta +.endif +.if !defined(NOPOSTINSTALL) + ${MAKEDIRTARGET} . postinstall-check +.endif + +_POSTINSTALL= ${.CURDIR}/usr.sbin/postinstall/postinstall \ + -m ${MACHINE} -a ${MACHINE_ARCH} +_POSTINSTALL_ENV= \ + AWK=${TOOL_AWK:Q} \ + DB=${TOOL_DB:Q} \ + HOST_SH=${HOST_SH:Q} \ + MAKE=${MAKE:Q} \ + PWD_MKDB=${TOOL_PWD_MKDB:Q} \ + SED=${TOOL_SED:Q} \ + STAT=${TOOL_STAT:Q} + +.if ${MKX11} != "no" +_POSTINSTALL_X11=-x ${X11SRCDIR:Q} +.endif + +postinstall-check: .PHONY + @echo " === Post installation checks ===" + ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi + @echo " ================================" + +postinstall-fix: .NOTMAIN .PHONY + @echo " === Post installation fixes ===" + ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix + @echo " ===============================" + +postinstall-fix-obsolete: .NOTMAIN .PHONY + @echo " === Removing obsolete files ===" + ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete + @echo " ===============================" + +postinstall-fix-obsolete_stand: .NOTMAIN .PHONY + @echo " === Removing obsolete files ===" + ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand + @echo " ===============================" +# +# Targets (in order!) called by "make build". +# +BUILDTARGETS+= check-tools +.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR) +BUILDTARGETS+= cleandir +.endif +.if ${MKOBJDIRS} != "no" +BUILDTARGETS+= do-top-obj +.endif +.if ${USETOOLS} == "yes" # { +.if ${MKOBJDIRS} != "no" +BUILDTARGETS+= do-tools-obj +.endif +BUILDTARGETS+= do-tools +.endif # USETOOLS # } +BUILDTARGETS+= params +.if ${MKOBJDIRS} != "no" +BUILDTARGETS+= obj +.endif +BUILDTARGETS+= clean_METALOG +.if !defined(NODISTRIBDIRS) +BUILDTARGETS+= do-distrib-dirs +.endif +.if !defined(NOINCLUDES) +BUILDTARGETS+= includes +.endif +BUILDTARGETS+= do-lib +.if !defined(__MINIX) +# LSC Not used in MINIX3 +BUILDTARGETS+= do-compat-lib +.endif # !defined(__MINIX) +.if ${MKX11} != "no" +BUILDTARGETS+= do-x11 +.endif +BUILDTARGETS+= do-build +.if ${MKEXTSRC} != "no" +BUILDTARGETS+= do-extsrc +.endif -install-world: - @echo - @echo "***************************************************************" - @echo "World Install For ${_ARCH} Started On `LC_ALL=C date`" - @echo "***************************************************************" - @echo - @echo "***************************************************************" - @echo "Step 1: Copy Binaries" - @echo "***************************************************************" - cp -pr build/bin/* ${ROOT}/bin/ - sync - @echo - @echo "***************************************************************" - @echo "Step 2: Copy Libraries" - @echo "***************************************************************" - cp -pr build/lib/* ${ROOT}/lib/ - cp -pr build/libexec/* ${ROOT}/libexec/ - sync - @echo - @echo "***************************************************************" - @echo "Step 3: Copy Etc" - @echo "***************************************************************" - cp -pr etc/* ${ROOT}/etc/ - sync - @echo - @echo "***************************************************************" - @echo "World Install For ${_ARCH} Completed On `LC_ALL=C date`" - @echo "***************************************************************" +.if defined(__MINIX) && ${MKSRC} == "yes" +BUILDTARGETS+= do-installsrc +.endif # defined(__MINIX) -clean-kernel: - (cd sys;${MAKE} clean) +BUILDTARGETS+= do-obsolete -install-kernel: - (cd sys;${MAKE} install-kernel) +# +# Enforce proper ordering of some rules. +# -install: install-world install-kernel - -clean: - (cd sys;${MAKE} clean) - (cd bin;${WMAKE} clean) - (cd lib;${WMAKE} clean) -# (cd src/lib/ubix;make clean) -# (cd src/lib/objgfx40;make clean) -# (cd src/lib/libcpp;make clean) -# (cd src/lib/views/sunlight;make clean) -# (cd src/lib/libstdc++;make clean) +.ORDER: ${BUILDTARGETS} +includes-lib: .PHONY includes-include includes-sys +includes-gnu: .PHONY includes-lib + +# +# Record the values of variables that might affect the build. +# If no values have changed, avoid updating the timestamp +# of the params file. +# +# This is referenced by _NETBSD_VERSION_DEPENDS in . +# +.include "${NETBSDSRCDIR}/etc/Makefile.params" +CLEANDIRFILES+= params +params: .EXEC + ${_MKMSG_CREATE} params + @${PRINT_PARAMS} >${.TARGET}.new + @if cmp -s ${.TARGET}.new ${.TARGET} > /dev/null 2>&1; then \ + : "params is unchanged" ; \ + rm ${.TARGET}.new ; \ + else \ + : "params has changed or is new" ; \ + mv ${.TARGET}.new ${.TARGET} ; \ + fi + +# +# Display current make(1) parameters +# +show-params: .PHONY .MAKE + @${PRINT_PARAMS} + +# +# Build the system and install into DESTDIR. +# + +START_TIME!= date + +.if defined(__MINIX) +world: build .PHONY .MAKE + ${MAKEDIRTARGET} . etcfiles + @echo "WARNING: " + @echo "WARNING: The 'world' target is obsolete, please use 'build' instead." + @echo "WARNING: " + +etcfiles: .PHONY .MAKE + ${MAKEDIRTARGET} etc install-etc-files-safe DESTDIR=${DESTDIR:U/} + +etcforce: .PHONY .MAKE + ${MAKEDIRTARGET} etc install-etc-files DESTDIR=${DESTDIR:U/} + +.endif # defined(__MINIX) + +build: .PHONY .MAKE +.if defined(BUILD_DONE) + @echo "Build already installed into ${DESTDIR}" +.else + @echo "Build started at: ${START_TIME}" +.for tgt in ${BUILDTARGETS} + ${MAKEDIRTARGET} . ${tgt} +.endfor + ${MAKEDIRTARGET} etc install-etc-release +.if defined(__MINIX) + ${MAKEDIRTARGET} etc install-etc-files-safe DESTDIR=${DESTDIR:U/} + ${MAKEDIRTARGET} releasetools do-hdboot +.endif # defined(__MINIX) + @echo "Build started at: ${START_TIME}" + @printf "Build finished at: " && date +.endif + +# +# Build a full distribution, but not a release (i.e. no sets into +# ${RELEASEDIR}). "buildworld" enforces a build to ${DESTDIR} != / +# + +distribution buildworld: .PHONY .MAKE +.if make(buildworld) && \ + (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") + @echo "Won't make ${.TARGET} with DESTDIR=/" + @false +.endif + ${MAKEDIRTARGET} . build NOPOSTINSTALL=1 + ${MAKEDIRTARGET} etc distribution INSTALL_DONE=1 +.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/" + ${MAKEDIRTARGET} . postinstall-fix-obsolete + ${MAKEDIRTARGET} . postinstall-fix-obsolete_stand + ${MAKEDIRTARGET} distrib/sets checkflist +.endif + @echo "make ${.TARGET} started at: ${START_TIME}" + @printf "make ${.TARGET} finished at: " && date + +# +# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/') +# If installing to /, ensures that the host's operating system is NetBSD and +# the host's `uname -m` == ${MACHINE}. +# + +HOST_UNAME_S!= uname -s +.if ${HOST_OSTYPE:C/\-.*//} != "Minix" +HOST_UNAME_M!= uname -m +.else +HOST_UNAME_M:= ${MACHINE} +.endif + +installworld: .PHONY .MAKE +.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") + @echo "Can't make ${.TARGET} to DESTDIR=/" + @false +.endif +.if !defined(INSTALLWORLDDIR) || \ + ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/" +.if (${HOST_UNAME_S} != "NetBSD") && (${HOST_UNAME_S} != "Minix") + @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to Minix with INSTALLWORLDDIR=/" + @false +.endif +.if (${HOST_UNAME_M} != ${MACHINE}) + @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/" + @false +.endif +.endif + ${MAKEDIRTARGET} distrib/sets installsets \ + INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q} + ${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR} + @echo "make ${.TARGET} started at: ${START_TIME}" + @printf "make ${.TARGET} finished at: " && date + +# +# Install modules from $DESTDIR to $INSTALLMODULESDIR +# +installmodules: .PHONY .MAKE +.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") + @echo "Can't make ${.TARGET} to DESTDIR=/" + @false +.endif +.if !defined(INSTALLMODULESDIR) || \ + ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/" +.if (${HOST_UNAME_S} != "NetBSD") + @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/" + @false +.endif +.if (${HOST_UNAME_M} != ${MACHINE}) + @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/" + @false +.endif +.endif + ${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/} + @echo "make ${.TARGET} started at: ${START_TIME}" + @printf "make ${.TARGET} finished at: " && date + +# +# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR +# + +.for tgt in sets sourcesets syspkgs +${tgt}: .PHONY .MAKE + ${MAKEDIRTARGET} distrib/sets ${tgt} +.endfor + +# +# Build a release or snapshot (implies "make distribution"). Note that +# in this case, the set lists will be checked before the tar files +# are made. +# + +release snapshot: .PHONY .MAKE + ${MAKEDIRTARGET} . distribution + ${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1 + @echo "make ${.TARGET} started at: ${START_TIME}" + @printf "make ${.TARGET} finished at: " && date + +# +# Create a CD-ROM image. +# + +iso-image: .PHONY + ${MAKEDIRTARGET} distrib iso_image + ${MAKEDIRTARGET} etc iso-image + @echo "make ${.TARGET} started at: ${START_TIME}" + @printf "make ${.TARGET} finished at: " && date + +iso-image-source: .PHONY + ${MAKEDIRTARGET} distrib iso_image CDSOURCE=true + ${MAKEDIRTARGET} etc iso-image + @echo "make ${.TARGET} started at: ${START_TIME}" + @printf "make ${.TARGET} finished at: " && date + +# +# Create bootable live images. +# + +live-image: .PHONY + ${MAKEDIRTARGET} etc live-image + @echo "make ${.TARGET} started at: ${START_TIME}" + @printf "make ${.TARGET} finished at: " && date + +# +# Create bootable installation images. +# + +install-image: .PHONY + ${MAKEDIRTARGET} etc install-image + @echo "make ${.TARGET} started at: ${START_TIME}" + @printf "make ${.TARGET} finished at: " && date + +# +# Special components of the "make build" process. +# + +check-tools: .PHONY +.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN) + @echo '*** WARNING: Building on MACHINE=${MACHINE} with missing toolchain.' + @echo '*** May result in a failed build or corrupt binaries!' +.elif defined(EXTERNAL_TOOLCHAIN) + @echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.' +.endif +.if defined(NBUILDJOBS) + @echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!' +.endif + +# Delete or sanitise a leftover METALOG from a previous build. +clean_METALOG: .PHONY .MAKE +.if ${MKUPDATE} != "no" + ${MAKEDIRTARGET} distrib/sets clean_METALOG +.endif + +do-distrib-dirs: .PHONY .MAKE +.if !defined(DESTDIR) || ${DESTDIR} == "" + ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/ +.else + ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR} +.endif + +.for targ in cleandir obj includes +do-${targ}: .PHONY ${targ} + @true +.endfor + +do-tools: .PHONY .MAKE + ${MAKEDIRTARGET} tools build_install + +do-lib: .PHONY .MAKE + ${MAKEDIRTARGET} lib build_install + +do-compat-lib: .PHONY .MAKE + ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib" + +do-top-obj: .PHONY .MAKE + ${MAKEDIRTARGET} . obj NOSUBDIR= + +do-tools-obj: .PHONY .MAKE + ${MAKEDIRTARGET} tools obj + +do-build: .PHONY .MAKE +.for targ in dependall install + ${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no +.endfor + +do-x11: .PHONY .MAKE +.if ${MKX11} != "no" + ${MAKEDIRTARGET} external/mit/xorg/tools all + ${MAKEDIRTARGET} external/mit/xorg/lib build_install +.if ${MKCOMPATX11} != "no" + ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../external/mit/xorg/lib" +.endif +.else + @echo "MKX11 is not enabled" + @false +.endif + +do-extsrc: .PHONY .MAKE +.if ${MKEXTSRC} != "no" + ${MAKEDIRTARGET} extsrc build +.else + @echo "MKEXTSRC is not enabled" + @false +.endif + +do-obsolete: .PHONY .MAKE + ${MAKEDIRTARGET} etc install-obsolete-lists + +# +# Speedup stubs for some subtrees that don't need to run these rules. +# (Tells not to recurse for them.) +# + +.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools +includes-${dir}: .PHONY + @true +.endfor +.for dir in etc distrib regress +install-${dir}: .PHONY + @true +.endfor + +.if defined(__MINIX) +SRCTAR=src.tar.gz +do-installsrc: + cd ${.CURDIR} && git ls-tree -r HEAD --name-only | tar czf ${.OBJDIR}/$(SRCTAR) -T - + ${INSTALL_FILE} ${.OBJDIR}/$(SRCTAR) ${DESTDIR}/usr/src/ +.endif # defined(__MINIX) + +# +# XXX this needs to change when distrib Makefiles are recursion compliant +# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first... +# +dependall-distrib depend-distrib all-distrib: .PHONY + @true + +.include +.include +.include diff --git a/src/Makefile.incl b/src/Makefile.incl index 30939ec..dd6fd02 100644 --- a/src/Makefile.incl +++ b/src/Makefile.incl @@ -14,6 +14,6 @@ _ARCH=i386 -REMOVE = rm -rf +#REMOVE = rm -rf -FD_DEVICE = /dev/md0 +#FD_DEVICE = /dev/md0 diff --git a/src/bin/init/Makefile b/src/bin/init/Makefile index bfbe689..e429432 100644 --- a/src/bin/init/Makefile +++ b/src/bin/init/Makefile @@ -1,45 +1,2 @@ -# $Id: Makefile 148 2016-01-18 19:34:32Z reddawg $ -# Application Makefile (C) 2002-2004 The UbixOS Project - -# Include Global 'Source' Options -include ../../Makefile.incl -include ../Makefile.incl - -#Linker -LD = ld - -#Binary File Name -BINARY = init - -#Delete Program -REMOVE = rm -f - -#Objects -OBJS = main.o - -#LIBRARIES = ../../lib/build/libc_old.static.so - -# Link The Binary -$(BINARY) : $(OBJS) - $(CC) $(CFLAGS) -static -o $(BUILD_DIR)/bin/$@ $(STARTUP) $(LIBRARIES) $(OBJS) -# strip $(BINARY) - -# Compile the source files -.cc.o: - $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< - -.cc.s: - $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< - -.c.o: - $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< - -.c.s: - $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< - -.S.o: - $(CC) -Wall $(CLFAGS) $(INCLUDES) -c -o $@ $< - -# Clean Up The junk -clean: - $(REMOVE) $(OBJS) $(BUILD_DIR)/bin/$(BINARY) +PROG=cat +.include diff --git a/src/bin/init/main.c b/src/bin/init/main.c index db777dd..076da7a 100644 --- a/src/bin/init/main.c +++ b/src/bin/init/main.c @@ -87,8 +87,6 @@ startup: i = fork(); - printf("FORKED: %i!\n", i); - if (0 == i) { printf("Starting Login Daemon.\n"); execve("sys:/bin/login",0x0,0x0); diff --git a/src/share/mk/bsd.dep.mk b/src/share/mk/bsd.dep.mk deleted file mode 100644 index c6cb500..0000000 --- a/src/share/mk/bsd.dep.mk +++ /dev/null @@ -1,142 +0,0 @@ -# $NetBSD: bsd.dep.mk,v 1.82 2014/12/01 01:34:30 erh Exp $ - -.if defined(__MINIX) -#LSC: Be a bit smarter about the default compiler -.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) -CC?= clang -.endif - -.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) -CC?= gcc -.endif - -MKDEP?= CC=${CC:Q} mkdep -MKDEPCXX?= CC=${CXX:Q} mkdep -.endif # defined(__MINIX) - -##### Basic targets -realdepend: beforedepend .depend afterdepend -.ORDER: beforedepend .depend afterdepend - -beforedepend .depend afterdepend: # ensure existence - -##### Default values -MKDEP?= mkdep -MKDEPCXX?= mkdep -MKDEP_SUFFIXES?= .o .d - -##### Build rules -# some of the rules involve .h sources, so remove them from mkdep line - -.if defined(SRCS) && !empty(SRCS) -__acpp_flags= ${_ASM_TRADITIONAL_CPP} - -.if defined(NODPSRCS) -.for f in ${SRCS} ${DPSRCS} -.if "${NODPSRCS:M${f}}" == "" -__DPSRCS.all+= ${f:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} -.endif -.endfor -beforedepend: ${DPSRCS} -.else -__DPSRCS.all+= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \ - ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} -.endif -__DPSRCS.d= ${__DPSRCS.all:O:u:M*.d} -__DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d} - -.if defined(__MINIX) -__DPSRCS.bcd= ${"${USE_BITCODE:Uno}" == "yes":? ${SRCS:M*.c:O:u:.c=.bcd}:} -__DPSRCS.d+= ${__DPSRCS.bcd} -.endif # defined(__MINIX) - -.NOPATH: .depend ${__DPSRCS.d} - -.if !empty(__DPSRCS.d) # { -${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS} -.endif # } - -MKDEPSUFFLAGS=-s ${MKDEP_SUFFIXES:Q} - -.if defined(MKDEPINCLUDES) && ${MKDEPINCLUDES} != "no" -.STALE: - @echo Rebuilding dependency file: ${.ALLSRC} - @rm -f ${.ALLSRC} - @(cd ${.CURDIR} && ${MAKE} depend) -_MKDEP_MERGEFLAGS=-i -_MKDEP_FILEFLAGS=${MKDEPSUFFLAGS} -.else -_MKDEP_MERGEFLAGS=${MKDEPSUFFLAGS} -_MKDEP_FILEFLAGS= -.endif - -.depend: ${__DPSRCS.d} - ${_MKTARGET_CREATE} - rm -f .depend - ${MKDEP} ${_MKDEP_MERGEFLAGS} -d -f ${.TARGET} ${__DPSRCS.d} - -.if !defined(__MINIX) -.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m -.else -.SUFFIXES: .bcd .d .s .S .c .C .cc .cpp .cxx .m - -.if ${USE_BITCODE:Uno} == "yes" -.c.bcd: - ${_MKTARGET_CREATE} - ${MKDEP} -f ${.TARGET} -s .bc -- ${MKDEPFLAGS} \ - ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ - ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -.endif # ${USE_BITCODE:Uno} == "yes" -.endif # !defined(__MINIX) - -.c.d: - ${_MKTARGET_CREATE} - ${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ - ${CFLAGS:M-std=*} ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ - ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ - ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \ - mv ${.TARGET}.tmp ${.TARGET} - -.m.d: - ${_MKTARGET_CREATE} - ${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ - ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ - ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ - ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \ - mv ${.TARGET}.tmp ${.TARGET} - -.s.d .S.d: - ${_MKTARGET_CREATE} - ${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ - ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ - ${CPPFLAGS} ${AFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} \ - ${__acpp_flags} ${.IMPSRC} && \ - mv ${.TARGET}.tmp ${.TARGET} - -.C.d .cc.d .cpp.d .cxx.d: - ${_MKTARGET_CREATE} - ${MKDEPCXX} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ - ${CXXFLAGS:M-std=*} ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ - ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ - ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \ - mv ${.TARGET}.tmp ${.TARGET} - -.endif # defined(SRCS) && !empty(SRCS) # } - -##### Clean rules -.if defined(SRCS) && !empty(SRCS) -CLEANDIRFILES+= .depend ${__DPSRCS.d} ${__DPSRCS.d:.d=.d.tmp} ${.CURDIR}/tags ${CLEANDEPEND} -.endif - -##### Custom rules -.if !target(tags) -tags: ${SRCS} -.if defined(SRCS) && !empty(SRCS) - ${_MKTARGET_CREATE} - -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ - ${TOOL_SED} "s;\${.CURDIR}/;;" > tags -.endif -.endif - -##### Pull in related .mk logic -.include diff --git a/src/share/mk/bsd.doc.mk b/src/share/mk/bsd.doc.mk deleted file mode 100644 index ef3e49f..0000000 --- a/src/share/mk/bsd.doc.mk +++ /dev/null @@ -1,219 +0,0 @@ -# $NetBSD: bsd.doc.mk,v 1.68 2015/08/04 08:36:14 dholland Exp $ -# @(#)bsd.doc.mk 8.1 (Berkeley) 8/14/93 - -.include - -# The makefile should set these: -# SECTION one of usd, smm, or psd (lower-case) -# ARTICLE name of this document -# SRCS roff source files -# DEPSRCS additional roff source files implicitly included -# MACROS name(s) of roff macro packages, including the -m -# ROFF_PIC set to "yes" to use pic(1) -# ROFF_EQN set to "yes" to use eqn(1) -# ROFF_TBL set to "yes" to use tbl(1) -# ROFF_REFER set to "yes" to use refer(1) -# EXTRAHTMLFILES additional files emitted as part of HTML build -# -# PAGES unknown (XXX) -# EXTRA extra files to install (XXX) -# -# If there are multiple docs to be generated, set these: -# SUBARTICLES= name1 name2 ... -# SRCS.name1= roff source files -# SRCS.name2= more roff source files -# SRCS. : = : -# DEPSRCS.name1= additional included roff source files -# DEPSRCS.name2= more additional included roff source files -# DEPSRCS. : = : -# -# I'm hoping that MACROS and ROFF_* can be uniform across all -# subarticles. - - -# Old bsd.doc.mk files tend to invoke tbl and other preprocessors -# directly; they should be changed to set ROFF_* instead. -# -# Also they set e.g. DIR=usd/72.mydocument; this should be changed -# to SECTION=usd and ARTICLE=mydocument. The article numbers are -# no longer present in the file system and do not need to be known -# at build time. -# - -# 20130908 dholland: Make sure all makefiles have been converted to the -# new scheme. -.if !defined(SECTION) -.error "bsd.doc.mk: SECTION must be defined" -.endif -.if target(paper.ps) -.error "bsd.doc.mk: target(paper.ps) is true -- this is not allowed" -.endif - -# 20130908 dholland: right now we cannot generate pdf from roff sources, -# so build compressed postscript instead. XXX. (and: yech) -TOOL_ROFF_PDF?=false "No roff pdf support" -PRINTABLE=ps.gz -#PRINTABLE=ps -#PRINTABLE=pdf - -# If there aren't subarticles, we generate one doc that has the same -# name as the top-level article. -SUBARTICLES?=${ARTICLE} -SRCS.${ARTICLE}?=${SRCS} -DEPSRCS.${ARTICLE}?=${DEPSRCS} - -##### Build - -.for SA in ${SUBARTICLES} -.if ${MKDOC} != "no" -realall: ${SA}.txt -realall: ${SA}.${PRINTABLE} -.if ${MKHTML} != "no" && ${MKGROFFHTMLDOC} != "no" -realall: ${SA}.html -.endif -.endif -.endfor # SUBARTICLES - -.if defined(ROFF_PIC) && ${ROFF_PIC} != "no" -ROFFFLAGS+=-p -.endif -.if defined(ROFF_EQN) && ${ROFF_EQN} != "no" -ROFFFLAGS+=-e -.endif -.if defined(ROFF_TBL) && ${ROFF_TBL} != "no" -ROFFFLAGS+=-t -.endif -.if defined(ROFF_REFER) && ${ROFF_REFER} != "no" -ROFFFLAGS+=-R -.endif -ROFFFLAGS+=-I${.CURDIR} - -.for SA in ${SUBARTICLES} - -# -# Find the sources. -# -# We can't use .IMPSRC in the rules because they aren't suffix rules -# (they could be for some docs, but not others) and we can't use -# .ALLSRC because that includes DEPSRCS. -# -# As far as I know, the only ways to get the path discovered via .PATH -# are those two magic variables or the P modifier. -# -# For some reason the P modifier finds the path to a variable name, -# not the path to a word in a variable. -# - -.for S in ${SRCS.${SA}} -SRCS2.${SA}+=${${S}:P} -.endfor -.for S in ${DEPSRCS.${SA}} -DEPSRCS2.${SA}+=${${S}:P} -.endfor - -# -# Note: we use TOOL_ROFF_DOCASCII because TOOL_ROFF_ASCII invokes -# the nroff wrapper instead of groff directly, and that doesn't -# understand -I. -# -# We use TOOL_ROFF_DOCHTML because TOOL_ROFF_HTML uses -mdoc2html, -# which is great if it works but doesn't work with at least some of -# the non-mdoc docs. (e.g. the curses one) TOOL_ROFF_DOCHTML uses -# groff -Thtml, which produces fairly blah output but works with these -# docs. It might end up being necessary to choose one or the other on -# a per-document basis... sigh. -# - -${SA}.txt: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} - ${_MKTARGET_FORMAT} - ${TOOL_ROFF_DOCASCII} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ - > ${.TARGET} - -${SA}.ps: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} - ${_MKTARGET_FORMAT} - ${TOOL_ROFF_PS} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ - | ${TOOL_SED} -e '/^%%CreationDate:/d' \ - > ${.TARGET} - -${SA}.pdf: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} - ${_MKTARGET_FORMAT} - ${TOOL_ROFF_PDF} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ - > ${.TARGET} - -${SA}.html: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} - ${_MKTARGET_FORMAT} - ${TOOL_ROFF_DOCHTML} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ - -P -I -P ${SA} \ - > ${.TARGET} - -${SA}.ps.gz: ${SA}.ps - ${TOOL_GZIP} -9 -c -n ${.ALLSRC} > ${.TARGET} - -.endfor # SUBARTICLES - -##### Install - -DOCINST:= -.for SA in ${SUBARTICLES} -DOCINST+=${SA}.txt ${SA}.${PRINTABLE} -.if ${MKHTML} != "no" && ${MKGROFFHTMLDOC} != "no" -DOCINST+=${SA}.html -.endif -.endfor -.if ${MKHTML} != "no" && ${MKGROFFHTMLDOC} != "no" -DOCINST+=${EXTRAHTMLFILES} -.endif - -.if ${MKDOC} != "no" -docinstall: -.for D in ${DOCINST} - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE} ${D} \ - ${DESTDIR}${DOCDIR}/${SECTION}/${ARTICLE}/${D} -.endfor -.else -docinstall: ; -.endif - -.PHONY: docinstall -realinstall: docinstall - -##### Clean - -cleandoc: -.for SA in ${SUBARTICLES} - rm -f ${SA}.txt ${SA}.ps ${SA}.ps.gz ${SA}.html -.endfor - rm -f ${EXTRAHTMLFILES} [eE]rrs mklog ${CLEANFILES} - -.PHONY: cleandoc -clean: cleandoc - -##### Extra custom rules - -.if !target(print) -print: ; -.PHONY: print -.for SA in ${SUBARTICLES} -print: print.${SA} -.PHONY: print.{SA} -print.${SA}: ${SA}.ps - lpr -P${PRINTER} ${.ALLSRC} -.endfor -.endif - -spell: ; -.PHONY: spell -.for SA in ${SUBARTICLES} -spell: spell.${SA} -.PHONY: spell.{SA} -spell.${SA}: ${SRCS2} ${DEPSRCS2} - spell ${SRCS2} | sort | comm -23 - spell.ok > paper.spell -.endfor - -##### Pull in related .mk logic - -.include -.include - -${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.endian.mk b/src/share/mk/bsd.endian.mk deleted file mode 100644 index 45ebf7c..0000000 --- a/src/share/mk/bsd.endian.mk +++ /dev/null @@ -1,33 +0,0 @@ -# $NetBSD: bsd.endian.mk,v 1.22 2014/09/19 17:45:42 matt Exp $ - -.if !defined(_BSD_ENDIAN_MK_) -_BSD_ENDIAN_MK_=1 - -.include - -.if ${MACHINE_ARCH} == "aarch64" || \ - ${MACHINE_ARCH} == "alpha" || \ - ${MACHINE_ARCH} == "arm" || \ - (!empty(MACHINE_ARCH:Mearm*) && empty(MACHINE_ARCH:Mearm*eb)) || \ - ${MACHINE_ARCH} == "i386" || \ - ${MACHINE_ARCH} == "ia64" || \ - ${MACHINE_ARCH} == "vax" || \ - ${MACHINE_ARCH} == "riscv32" || \ - ${MACHINE_ARCH} == "riscv64" || \ - ${MACHINE_ARCH} == "x86_64" || \ - ${MACHINE_ARCH:C/^.*el$/el/} == "el" -TARGET_ENDIANNESS= 1234 -.elif ${MACHINE_ARCH} == "coldfire" || \ - ${MACHINE_ARCH} == "hppa" || \ - ${MACHINE_ARCH} == "m68000" || \ - ${MACHINE_ARCH} == "m68k" || \ - ${MACHINE_ARCH} == "or1k" || \ - ${MACHINE_ARCH} == "powerpc" || \ - ${MACHINE_ARCH} == "powerpc64" || \ - ${MACHINE_ARCH} == "sparc" || \ - ${MACHINE_ARCH} == "sparc64" || \ - ${MACHINE_ARCH:C/^.*eb$/eb/} == "eb" -TARGET_ENDIANNESS= 4321 -.endif - -.endif # !defined(_BSD_ENDIAN_MK_) diff --git a/src/share/mk/bsd.files.mk b/src/share/mk/bsd.files.mk deleted file mode 100644 index 4a1df65..0000000 --- a/src/share/mk/bsd.files.mk +++ /dev/null @@ -1,162 +0,0 @@ -# $NetBSD: bsd.files.mk,v 1.43 2013/04/06 15:39:19 uebayasi Exp $ - -.if !defined(_BSD_FILES_MK_) -_BSD_FILES_MK_=1 - -.include - -.if !target(__fileinstall) -##### Basic targets -realinstall: filesinstall -realall: filesbuild - -##### Default values -FILESDIR?= ${BINDIR} -FILESOWN?= ${BINOWN} -FILESGRP?= ${BINGRP} -FILESMODE?= ${NONBINMODE} - -##### Build rules -filesbuild: -.PHONY: filesbuild - -##### Install rules -filesinstall:: # ensure existence -.PHONY: filesinstall - -configfilesinstall:: .PHONY - -__fileinstall: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} \ - -o ${FILESOWN_${.ALLSRC:T}:U${FILESOWN}} \ - -g ${FILESGRP_${.ALLSRC:T}:U${FILESGRP}} \ - -m ${FILESMODE_${.ALLSRC:T}:U${FILESMODE}} \ - ${SYSPKGTAG} ${.ALLSRC} ${.TARGET} - -.endif # !target(__fileinstall) - - -.for F in ${FILES:O:u} -_FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override -_FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override -_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path -_FDOBUILD:= ${FILESBUILD_${F}:U${FILESBUILD:Uno}} - -.if ${MKUPDATE} == "no" -${_F}! ${F} __fileinstall # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") -${_F}! .MADE # no build at install -.endif -.else -${_F}: ${F} __fileinstall # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") -${_F}: .MADE # no build at install -.endif -.endif - -.if ${_FDOBUILD} != "no" -filesbuild: ${F} -CLEANFILES+= ${F} -.endif - -filesinstall:: ${_F} -.PRECIOUS: ${_F} # keep if install fails -.endfor - - -# -# CONFIGFILES -# -configinstall: configfilesinstall - -.for F in ${CONFIGFILES:O:u} -_FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override -_FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override -_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path -_FDOBUILD:= ${FILESBUILD_${F}:U${FILESBUILD:Uno}} - -.if ${MKUPDATE} == "no" -${_F}! ${F} __fileinstall # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") -${_F}! .MADE # no build at install -.endif -.else -${_F}: ${F} __fileinstall # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") -${_F}: .MADE # no build at install -.endif -.endif - -.if ${_FDOBUILD} != "no" -filesbuild: ${F} -CLEANFILES+= ${F} -.endif - -configfilesinstall:: ${_F} -.PRECIOUS: ${_F} # keep if install fails -.endfor - -.undef _FDIR -.undef _FNAME -.undef _F - - -# -# BUILDSYMLINKS -# -.if defined(BUILDSYMLINKS) # { - -.for _SL _TL in ${BUILDSYMLINKS} -BUILDSYMLINKS.s+= ${_SL} -BUILDSYMLINKS.t+= ${_TL} -${_TL}: ${_SL} - ${_MKMSG} "symlink " ${.CURDIR:T}/${.TARGET} - rm -f ${.TARGET} - ln -s ${.ALLSRC} ${.TARGET} -.endfor - -realall: ${BUILDSYMLINKS.t} - -CLEANDIRFILES+= ${BUILDSYMLINKS.t} - -.endif # } - -# -# .uue -> "" handling (i.e. decode a given binary/object) -# -# UUDECODE_FILES - List of files which are stored in the source tree -# as .uue and should be uudecoded. -# -# UUDECODE_FILES_RENAME_fn - For this file, rename its output to the provided -# name (handled via -p and redirecting stdout) - -.if defined(UUDECODE_FILES) # { -.SUFFIXES: .uue - -.uue: - ${_MKTARGET_CREATE} - rm -f ${.TARGET} - ${TOOL_UUDECODE} -p ${.IMPSRC} > ${.TARGET} - -.if defined(UUDECODE_FILES_RENAME_${UUDECODE_FILES}) -${UUDECODE_FILES_RENAME_${UUDECODE_FILES}}: ${UUDECODE_FILES} - cp ${.ALLSRC} ${.TARGET} -.endif - -realall: ${UUDECODE_FILES} - -CLEANUUDECODE_FILES=${UUDECODE_FILES} -.for i in ${UUDECODE_FILES} -CLEANUUDECODE_FILES+=${UUDECODE_FILES_RENAME_${i}} -.endfor - -CLEANFILES+= ${CLEANUUDECODE_FILES} -.endif # } - -##### Pull in related .mk logic -.include -.include -.include - -.endif # !defined(_BSD_FILES_MK_) diff --git a/src/share/mk/bsd.gcc.mk b/src/share/mk/bsd.gcc.mk deleted file mode 100644 index 916bb66..0000000 --- a/src/share/mk/bsd.gcc.mk +++ /dev/null @@ -1,34 +0,0 @@ -# $NetBSD: bsd.gcc.mk,v 1.11 2015/06/07 15:04:28 matt Exp $ - -.if !defined(_BSD_GCC_MK_) -_BSD_GCC_MK_=1 - -.if defined(EXTERNAL_TOOLCHAIN) -_GCC_CRTBEGIN!= ${CC} --print-file-name=crtbegin.o -.ifndef _GCC_CRTBEGINS -_GCC_CRTBEGINS!= ${CC} --print-file-name=crtbeginS.o -.endif -_GCC_CRTEND!= ${CC} --print-file-name=crtend.o -.ifndef _GCC_CRTENDS -_GCC_CRTENDS!= ${CC} --print-file-name=crtendS.o -.endif -.ifndef _GCC_CRTI -_GCC_CRTI!= ${CC} --print-file-name=crti.o -.endif -.ifndef _GCC_CRTN -_GCC_CRTN!= ${CC} --print-file-name=crtn.o -.endif -_GCC_CRTDIR!= dirname ${_GCC_CRTBEGIN} -_GCC_LIBGCCDIR!= dirname `${CC} --print-libgcc-file-name` -.else -_GCC_CRTBEGIN?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtbegin.o -_GCC_CRTBEGINS?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtbeginS.o -_GCC_CRTEND?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtend.o -_GCC_CRTENDS?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtendS.o -_GCC_CRTI?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o -_GCC_CRTN?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtn.o -_GCC_CRTDIR?= ${DESTDIR}/usr/lib${MLIBDIR:D/${MLIBDIR}} -_GCC_LIBGCCDIR?= ${DESTDIR}/usr/lib${MLIBDIR:D/${MLIBDIR}} -.endif - -.endif # ! defined(_BSD_GCC_MK_) diff --git a/src/share/mk/bsd.host.mk b/src/share/mk/bsd.host.mk deleted file mode 100644 index 1a105e6..0000000 --- a/src/share/mk/bsd.host.mk +++ /dev/null @@ -1,76 +0,0 @@ -# $NetBSD: bsd.host.mk,v 1.2 2014/04/10 19:02:18 plunky Exp $ - -.if !defined(_BSD_HOST_MK_) -_BSD_HOST_MK_=1 - -.if ${HOST_OSTYPE:C/\-.*//:U} == "Minix" -HOST_LDFLAGS?= -static - -#LSC: Be a bit smarter about the default compiler -.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) -HOST_CC?= clang -.endif - -.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) -HOST_CC?= gcc -.endif -.endif # ${HOST_OSTYPE:C/\-.*//:U} == "Minix" - -# Helpers for cross-compiling -HOST_CC?= cc -HOST_CFLAGS?= -O -HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c -HOST_COMPILE.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} -c -HOST_LINK.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} -.if defined(HOSTPROG_CXX) -HOST_LINK.c?= ${HOST_LINK.cc} -.else -HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} -.endif - -HOST_CXX?= c++ -HOST_CXXFLAGS?= -O - -HOST_CPP?= cpp -HOST_CPPFLAGS?= - -HOST_LD?= ld -HOST_LDFLAGS?= - -HOST_AR?= ar -HOST_RANLIB?= ranlib - -HOST_LN?= ln - -# HOST_SH must be an absolute path -HOST_SH?= /bin/sh - -.if !defined(HOST_OSTYPE) -_HOST_OSNAME!= uname -s -_HOST_OSREL!= uname -r -# For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints -# something that does not look like an identifier, then use uname -m. -_HOST_ARCH!= uname -p 2>/dev/null -_HOST_ARCH:= ${HOST_ARCH:tW:C/.*[^-_A-Za-z0-9].*//:S/unknown//} -.if empty(_HOST_ARCH) -_HOST_ARCH!= uname -m -.endif -HOST_OSTYPE:= ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g} -.MAKEOVERRIDES+= HOST_OSTYPE -.endif # !defined(HOST_OSTYPE) - -.if ${USETOOLS} == "yes" -HOST_MKDEP?= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep -HOST_MKDEPCXX?= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep -.else -HOST_MKDEP?= CC=${HOST_CC:Q} mkdep -HOST_MKDEPCXX?= CC=${HOST_CXX:Q} mkdep -.endif - -.if ${NEED_OWN_INSTALL_TARGET} != "no" -HOST_INSTALL_FILE?= ${INSTALL} ${COPY} ${PRESERVE} ${RENAME} -HOST_INSTALL_DIR?= ${INSTALL} -d -HOST_INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK} ${RENAME} -.endif - -.endif diff --git a/src/share/mk/bsd.hostlib.mk b/src/share/mk/bsd.hostlib.mk deleted file mode 100644 index debf501..0000000 --- a/src/share/mk/bsd.hostlib.mk +++ /dev/null @@ -1,57 +0,0 @@ -# $NetBSD: bsd.hostlib.mk,v 1.19 2014/12/01 01:34:30 erh Exp $ - -.include -.include - -##### Basic targets - -##### Default values -CFLAGS+= ${COPTS} -MKDEP_SUFFIXES?= .o .lo .d - -# Override these: -MKDEP:= ${HOST_MKDEP} -MKDEPCXX:= ${HOST_MKDEPCXX} - -.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) -OBJHOSTMACHINE= # set -.endif - -##### Build rules -.if defined(HOSTLIB) -_YHLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} -DPSRCS+= ${_YHLSRCS} -CLEANFILES+= ${_YHLSRCS} -.endif # defined(HOSTLIB) - -.if !empty(SRCS:N*.h:N*.sh) -OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g} -.endif - -.if defined(OBJS) && !empty(OBJS) -.NOPATH: lib${HOSTLIB}.a ${OBJS} ${_YHLSRCS} - -${OBJS}: ${DPSRCS} - -lib${HOSTLIB}.a: ${OBJS} ${DPADD} - ${_MKTARGET_BUILD} - rm -f ${.TARGET} - ${HOST_AR} cq ${.TARGET} ${OBJS} - ${HOST_RANLIB} ${.TARGET} - -.endif # defined(OBJS) && !empty(OBJS) - -realall: lib${HOSTLIB}.a - -CLEANFILES+= a.out [Ee]rrs mklog core *.core lib${HOSTLIB}.a ${OBJS} - -beforedepend: -CFLAGS:= ${HOST_CFLAGS} -CPPFLAGS:= ${HOST_CPPFLAGS} - -##### Pull in related .mk logic -.include -.include -.include - -${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.hostprog.mk b/src/share/mk/bsd.hostprog.mk deleted file mode 100644 index 9b2b99d..0000000 --- a/src/share/mk/bsd.hostprog.mk +++ /dev/null @@ -1,172 +0,0 @@ -# $NetBSD: bsd.hostprog.mk,v 1.74 2014/12/01 01:34:30 erh Exp $ -# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 - -.include -.include - -##### Basic targets - -##### Default values -LIBATF_C?= /usr/lib/libatf-c.a -LIBATF_CXX?= /usr/lib/libatf-c++.a -LIBBLUETOOTH?= /usr/lib/libbluetooth.a -LIBBZ2?= /usr/lib/libbz2.a -LIBC?= /usr/lib/libc.a -LIBC_PIC?= /usr/lib/libc_pic.a -LIBC_SO?= /usr/lib/libc.so -LIBCOMPAT?= /usr/lib/libcompat.a -LIBCRYPT?= /usr/lib/libcrypt.a -LIBCURSES?= /usr/lib/libcurses.a -LIBDBM?= /usr/lib/libdbm.a -LIBDES?= /usr/lib/libdes.a -LIBEDIT?= /usr/lib/libedit.a -LIBEVENT?= /usr/lib/libevent.a -LIBEVENT_OPENSSL?= /usr/lib/libevent_openssl.a -LIBEVENT_PTHREADS?= /usr/lib/libevent_pthreads.a -LIBEXPAT?= /usr/lib/libexpat.a -LIBFETCH?= /usr/lib/libfetch.a -LIBFORM?= /usr/lib/libform.a -LIBGCC?= /usr/lib/libgcc.a -LIBGNUMALLOC?= /usr/lib/libgnumalloc.a -LIBINTL?= /usr/lib/libintl.a -LIBIPSEC?= /usr/lib/libipsec.a -LIBKVM?= /usr/lib/libkvm.a -LIBL?= /usr/lib/libl.a -LIBLUTOK?= /usr/lib/liblutok.a -LIBLZMA?= /usr/lib/liblzma.a -LIBM?= /usr/lib/libm.a -LIBMAGIC?= /usr/lib/libmagic.a -LIBMENU?= /usr/lib/libmenu.a -LIBMP?= /usr/lib/libmp.a -LIBNTP?= /usr/lib/libntp.a -LIBOBJC?= /usr/lib/libobjc.a -LIBP2K?= /usr/lib/libp2k.a -LIBPC?= /usr/lib/libpc.a -LIBPCAP?= /usr/lib/libpcap.a -LIBPCI?= /usr/lib/libpci.a -LIBPLOT?= /usr/lib/libplot.a -LIBPOSIX?= /usr/lib/libposix.a -LIBPUFFS?= /usr/lib/libpuffs.a -LIBQUOTA?= /usr/lib/libquota.a -LIBRESOLV?= /usr/lib/libresolv.a -LIBRPCSVC?= /usr/lib/librpcsvc.a -LIBRUMP?= /usr/lib/librump.a -LIBRUMPCLIENT?= /usr/lib/librumpclient.a -LIBRUMPNET?= /usr/lib/librumpnet.a -LIBRUMPUSER?= /usr/lib/librumpuser.a -LIBRUMPVFS?= /usr/lib/librumpvfs.a -LIBSKEY?= /usr/lib/libskey.a -LIBSQLITE3?= /usr/lib/libsqlite3.a -LIBSSP?= /usr/lib/libssp.a -LIBSTDCXX?= /usr/lib/libstdc++.a -LIBSUPCXX?= /usr/lib/libsupc++.a -LIBTERMINFO?= /usr/lib/libterminfo.a -LIBUTIL?= /usr/lib/libutil.a -LIBWRAP?= /usr/lib/libwrap.a -LIBUKFS?= /usr/lib/libukfs.a -LIBY?= /usr/lib/liby.a -LIBZ?= /usr/lib/libz.a - -##### rump file system modules -LIBRUMPFS_CD9660FS?= /usr/lib/librumpfs_cd9660fs.a -LIBRUMPFS_EFS?= /usr/lib/librumpfs_efs.a -LIBRUMPFS_EXT2FS?= /usr/lib/librumpfs_ext2fs.a -LIBRUMPFS_FFS?= /usr/lib/librumpfs_ffs.a -LIBRUMPFS_HFS?= /usr/lib/librumpfs_hfs.a -LIBRUMPFS_LFS?= /usr/lib/librumpfs_lfs.a -LIBRUMPFS_MSDOSFS?= /usr/lib/librumpfs_msdosfs.a -LIBRUMPFS_NTFS?= /usr/lib/librumpfs_ntfs.a -LIBRUMPFS_SYSPUFFS?= /usr/lib/librumpfs_syspuffs.a -LIBRUMPFS_TMPFS?= /usr/lib/librumpfs_tmpfs.a -LIBRUMPFS_UDF?= /usr/lib/librumpfs_udf.a -LIBRUMPFS_UFS?= /usr/lib/librumpfs_ufs.a - -MKDEP_SUFFIXES?= .lo .ln .d - -# Override these: -INSTALL:= ${INSTALL:NSTRIP=*} -MKDEP:= ${HOST_MKDEP} -MKDEPCXX:= ${HOST_MKDEPCXX} - -.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) -OBJHOSTMACHINE= # set -.endif - -##### Build rules -.if defined(HOSTPROG_CXX) -HOSTPROG= ${HOSTPROG_CXX} -.endif - -.if defined(HOSTPROG) -SRCS?= ${HOSTPROG}.c - -_YHPSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} -DPSRCS+= ${_YHPSRCS} -CLEANFILES+= ${_YHPSRCS} - -.if !empty(SRCS:N*.h:N*.sh) -OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g} -LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} -.endif - -.if defined(OBJS) && !empty(OBJS) -.NOPATH: ${OBJS} ${HOSTPROG} ${_YHPSRCS} - -${OBJS} ${LOBJS}: ${DPSRCS} -${HOSTPROG}: ${OBJS} ${DPADD} - ${_MKTARGET_LINK} - ${HOST_LINK.c} ${HOST_LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} -.if !empty(.MAKE.OS:M*CYGWIN*) - ${HOST_SH} ${NETBSDSRCDIR}/tools/binstall/mkmanifest ${HOSTPROG} -.endif - - -.endif # defined(OBJS) && !empty(OBJS) - -.if !defined(MAN) -MAN= ${HOSTPROG}.1 -.endif # !defined(MAN) -.endif # defined(HOSTPROG) - -realall: ${HOSTPROG} - -CLEANFILES+= a.out [Ee]rrs mklog core *.core ${HOSTPROG} ${OBJS} ${LOBJS} - -beforedepend: -CFLAGS:= ${HOST_CFLAGS} -CPPFLAGS:= ${HOST_CPPFLAGS:N-Wp,-iremap,*} - -lint: ${LOBJS} -.if defined(LOBJS) && !empty(LOBJS) - ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD} -.endif - -##### Pull in related .mk logic -LINKSMODE?= ${BINMODE} -.include -.include -.include -.include -.include -.include -.include - -${TARGETS}: # ensure existence - -# Override YACC/LEX rules so nbtool_config.h can be forced as the 1st include -.l.c: - ${_MKTARGET_LEX} - ${LEX.l} -o${.TARGET} ${.IMPSRC} - echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1 - echo '#include "nbtool_config.h"' >> ${.TARGET}.1 - echo '#endif' >> ${.TARGET}.1 - cat ${.TARGET} >> ${.TARGET}.1 - mv ${.TARGET}.1 ${.TARGET} -.y.c: - ${_MKTARGET_YACC} - ${YACC.y} -o ${.TARGET} ${.IMPSRC} - echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1 - echo '#include "nbtool_config.h"' >> ${.TARGET}.1 - echo '#endif' >> ${.TARGET}.1 - cat ${.TARGET} >> ${.TARGET}.1 - mv ${.TARGET}.1 ${.TARGET} diff --git a/src/share/mk/bsd.inc.mk b/src/share/mk/bsd.inc.mk deleted file mode 100644 index 9672743..0000000 --- a/src/share/mk/bsd.inc.mk +++ /dev/null @@ -1,57 +0,0 @@ -# $NetBSD: bsd.inc.mk,v 1.32 2006/03/16 18:43:34 jwise Exp $ - -.include - -##### Basic targets -includes: ${INCS} incinstall inclinkinstall - -##### Default values -INCSYMLINKS?= - -##### Install rules -incinstall:: # ensure existence -.PHONY: incinstall - -# -c is forced on here, in order to preserve modtimes for "make depend" -__incinstall: .USE - @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ - (${_MKSHMSG_INSTALL} ${.TARGET}; \ - ${_MKSHECHO} "${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ - -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \ - ${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ - -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}) - -.for F in ${INCS:O:u} -_FDIR:= ${INCSDIR_${F:C,/,_,g}:U${INCSDIR}} # dir override -_FNAME:= ${INCSNAME_${F:C,/,_,g}:U${INCSNAME:U${F}}} # name override -_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path - -.if ${MKUPDATE} == "no" -${_F}! ${F} __incinstall # install rule -.else -${_F}: ${F} __incinstall # install rule -.endif - -incinstall:: ${_F} -.PRECIOUS: ${_F} # keep if install fails -.endfor - -.undef _FDIR -.undef _FNAME -.undef _F - -inclinkinstall: .PHONY -.if !empty(INCSYMLINKS) - @(set ${INCSYMLINKS}; \ - while test $$# -ge 2; do \ - l=$$1; shift; \ - t=${DESTDIR}$$1; shift; \ - if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ - [ "$$l" = "$$ttarg" ]; then \ - continue ; \ - fi ; \ - ${_MKSHMSG_INSTALL} $$t; \ - ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ - ${INSTALL_SYMLINK} $$l $$t; \ - done; ) -.endif diff --git a/src/share/mk/bsd.info.mk b/src/share/mk/bsd.info.mk deleted file mode 100644 index ef6bd1f..0000000 --- a/src/share/mk/bsd.info.mk +++ /dev/null @@ -1,87 +0,0 @@ -# $NetBSD: bsd.info.mk,v 1.40 2011/09/10 16:57:35 apb Exp $ - -.include - -##### Basic targets -realinstall: infoinstall - -##### Default values -INFOFLAGS?= - -INFOFILES?= - -##### Build rules -.if ${MKINFO} != "no" - -INFOFILES= ${TEXINFO:C/\.te?xi(nfo)?$/.info/} - -realall: ${INFOFILES} -.NOPATH: ${INFOFILES} - -.SUFFIXES: .txi .texi .texinfo .info - -.txi.info .texi.info .texinfo.info: - ${_MKTARGET_CREATE} - ${TOOL_MAKEINFO} ${INFOFLAGS} --no-split --no-version-header -o ${.TARGET} ${.IMPSRC} - -.endif # ${MKINFO} != "no" - -##### Install rules -infoinstall:: # ensure existence -.PHONY: infoinstall - -.if ${MKINFO} != "no" - -INFODIRFILE=${DESTDIR}${INFODIR}/dir - -# serialize access to ${INFODIRFILE}; needed for parallel makes -__infoinstall: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} \ - -o ${INFOOWN_${.ALLSRC:T}:U${INFOOWN}} \ - -g ${INFOGRP_${.ALLSRC:T}:U${INFOGRP}} \ - -m ${INFOMODE_${.ALLSRC:T}:U${INFOMODE}} \ - ${.ALLSRC} ${.TARGET} - @[ -f ${INFODIRFILE} ] && \ - while ! ln ${INFODIRFILE} ${INFODIRFILE}.lock 2> /dev/null; \ - do sleep 1; done; \ - ${TOOL_INSTALL_INFO} -d ${INFODIRFILE} -r ${.TARGET} 2> /dev/null; \ - ${TOOL_INSTALL_INFO} -d ${INFODIRFILE} ${.TARGET}; \ - rm -f ${INFODIRFILE}.lock - - -.for F in ${INFOFILES:O:u} -_FDIR:= ${INFODIR_${F}:U${INFODIR}} # dir overrides -_FNAME:= ${INFONAME_${F}:U${INFONAME:U${F:T}}} # name overrides -_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path - -.if ${MKUPDATE} == "no" -${_F}! ${F} __infoinstall # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}! .MADE # no build at install -.endif -.else -${_F}: ${F} __infoinstall # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}: .MADE # no build at install -.endif -.endif - -infoinstall:: ${_F} -.PRECIOUS: ${_F} # keep if install fails -.endfor - -.undef _FDIR -.undef _FNAME -.undef _F -.endif # ${MKINFO} != "no" - -##### Clean rules -CLEANDIRFILES+= ${INFOFILES} - -##### Pull in related .mk logic -.include -.include -.include - -${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.init.mk b/src/share/mk/bsd.init.mk deleted file mode 100644 index 22dc168..0000000 --- a/src/share/mk/bsd.init.mk +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: bsd.init.mk,v 1.2 2003/07/28 02:38:33 lukem Exp $ - -# includes Makefile.inc and ; this is used at the -# top of all files which actually "build something". - -.if !defined(_BSD_INIT_MK_) -_BSD_INIT_MK_=1 - -.-include "${.CURDIR}/../Makefile.inc" -.include -.MAIN: all - -.endif # !defined(_BSD_INIT_MK_) diff --git a/src/share/mk/bsd.ioconf.mk b/src/share/mk/bsd.ioconf.mk deleted file mode 100644 index c1acac5..0000000 --- a/src/share/mk/bsd.ioconf.mk +++ /dev/null @@ -1,41 +0,0 @@ -# $NetBSD: bsd.ioconf.mk,v 1.5 2014/11/30 15:53:29 uebayasi Exp $ -# - -.include - -# If IOCONF is defined, autocreate ioconf.[ch] and locators.h. -# This is useful mainly for devices. -.if !empty(IOCONF) - -# discourage direct inclusion. bsd.ioconf.mk will hopefully go away -# when the kernel build procedures are unified. -.if defined(_BSD_IOCONF_MK_USER_) - -# XXX: ioconf.c doesn't need to depend on TOOL_CONFIG, but that helps -# keep builds working while hashing out some of the experimental -# features related to ioconf. -.if ${USETOOLS} == "yes" -CONFIGDEP=${TOOL_CONFIG} -.endif -ioconf.c: ${IOCONF} ${CONFIGDEP} - ${TOOL_CONFIG} ${CONFIGOPTS} -b ${.OBJDIR} -s ${S} \ - ${IOCONFDIR:U${.CURDIR}}/${IOCONF} - # config doesn't change the files if they're unchanged. however, - # here we want to satisfy our make dependency, so force a - # timestamp update - touch ioconf.c ioconf.h locators.h - -.else # _BSD_IOCONF_MK_USER_ - -ioconf.c: - @echo do not include bsd.ioconf.mk directly - @false - -.endif # _BSD_IOCONF_MK_USER_ - -locators.h: ioconf.c -ioconf.h: ioconf.c - -CLEANFILES+= ioconf.c ioconf.h locators.h -DPSRCS+= ioconf.c ioconf.h locators.h -.endif diff --git a/src/share/mk/bsd.kernobj.mk b/src/share/mk/bsd.kernobj.mk deleted file mode 100644 index ba3c9ed..0000000 --- a/src/share/mk/bsd.kernobj.mk +++ /dev/null @@ -1,33 +0,0 @@ -# $NetBSD: bsd.kernobj.mk,v 1.14 2013/06/03 07:39:07 mrg Exp $ - -# KERNSRCDIR Is the location of the top of the kernel src. -# It defaults to `${NETBSDSRCDIR}/sys'. -# -# KERNARCHDIR Is the location of the machine dependent kernel sources. -# It defaults to `arch/${MACHINE}', but may be overridden -# in case ${MACHINE} is not correct. -# -# KERNCONFDIRDEFAULT Is the default for ${KERNCONFDIR}. -# It defaults to `${KERNSRCDIR}/${KERNARCHDIR}/conf'. -# -# KERNCONFDIR Is where the configuration files for kernels are found. -# Users can set this to have build.sh find kernel -# configurations in another directory. -# It defaults to `${KERNCONFDIRDEFAULT}'. -# -# KERNOBJDIR Is the kernel build directory. The kernel GENERIC for -# instance will be compiled in ${KERNOBJDIR}/GENERIC. -# The default is the .OBJDIR of -# `${KERNSRCDIR}/${KERNARCHDIR}/compile'. -# - -.include - -KERNSRCDIR?= ${NETBSDSRCDIR}/sys -KERNARCHDIR?= arch/${MACHINE} -KERNCONFDIRDEFAULT?= ${KERNSRCDIR}/${KERNARCHDIR}/conf -KERNCONFDIR?= ${KERNCONFDIRDEFAULT} - -.if !defined(KERNOBJDIR) && exists(${KERNSRCDIR}/${KERNARCHDIR}/compile) -KERNOBJDIR!= cd "${KERNSRCDIR}/${KERNARCHDIR}/compile" && ${PRINTOBJDIR} -.endif diff --git a/src/share/mk/bsd.kinc.mk b/src/share/mk/bsd.kinc.mk deleted file mode 100644 index bb4b035..0000000 --- a/src/share/mk/bsd.kinc.mk +++ /dev/null @@ -1,84 +0,0 @@ -# $NetBSD: bsd.kinc.mk,v 1.36 2006/03/16 18:43:34 jwise Exp $ - -# Variables: -# -# INCSDIR Directory to install includes into (and/or make, and/or -# symlink, depending on what's going on). -# -# INCS Headers to install. -# -# DEPINCS Headers to install which are built dynamically. -# -# SUBDIR Subdirectories to enter -# -# INCSYMLINKS 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. -# - -.include - -##### Basic targets -.PRECIOUS: ${DESTDIR}${INCSDIR} -includes: ${DESTDIR}${INCSDIR} .WAIT ${INCS} incinstall - -##### Install rules -incinstall:: # ensure existence -.PHONY: incinstall - -# make sure the directory is OK, and install includes. - -${DESTDIR}${INCSDIR}: .EXEC - @if [ ! -d ${.TARGET} ] || [ -h ${.TARGET} ] ; then \ - ${_MKSHMSG_CREATE} ${.TARGET}; \ - /bin/rm -rf ${.TARGET}; \ - ${_MKSHECHO} ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \ - ${.TARGET}; \ - ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \ - ${.TARGET}; \ - fi - -# -c is forced on here, in order to preserve modtimes for "make depend" -__incinstall: .USE - @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ - (${_MKSHMSG_INSTALL} ${.TARGET}; \ - ${_MKSHECHO} "${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ - -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \ - ${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ - -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}) - -.for F in ${INCS:O:u} ${DEPINCS:O:u} -_F:= ${DESTDIR}${INCSDIR}/${F} # installed path - -.if ${MKUPDATE} == "no" -${_F}! ${F} __incinstall # install rule -.else -${_F}: ${F} __incinstall # install rule -.endif - -incinstall:: ${_F} -.PRECIOUS: ${_F} # keep if install fails -.endfor - -.undef _F - -.if defined(INCSYMLINKS) && !empty(INCSYMLINKS) -incinstall:: - @(set ${INCSYMLINKS}; \ - while test $$# -ge 2; do \ - l=$$1; shift; \ - t=${DESTDIR}$$1; shift; \ - if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ - [ "$$l" = "$$ttarg" ]; then \ - continue ; \ - fi ; \ - ${_MKSHMSG_INSTALL} $$t; \ - ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ - ${INSTALL_SYMLINK} $$l $$t; \ - done; ) -.endif - -##### Pull in related .mk logic -.include -.include diff --git a/src/share/mk/bsd.klinks.mk b/src/share/mk/bsd.klinks.mk deleted file mode 100644 index 2616e4a..0000000 --- a/src/share/mk/bsd.klinks.mk +++ /dev/null @@ -1,87 +0,0 @@ -# $NetBSD: bsd.klinks.mk,v 1.13 2014/08/10 05:57:31 matt Exp $ -# - -.include - -KLINK_MACHINE?= ${MACHINE} - -##### Default values -.if !defined(S) -.if defined(NETBSDSRCDIR) -S= ${NETBSDSRCDIR}/sys -.elif defined(BSDSRCDIR) -S= ${BSDSRCDIR}/sys -.else -S= /sys -.endif -.endif - -CLEANFILES+= machine ${MACHINE_CPU} ${KLINK_MACHINE} -.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" -CLEANFILES+= sun68k -.elif ${KLINK_MACHINE} == "sparc64" -CLEANFILES+= sparc -.elif ${KLINK_MACHINE} == "i386" -CLEANFILES+= x86 -.elif ${KLINK_MACHINE} == "amd64" -CLEANFILES+= x86 i386 -.elif ${KLINK_MACHINE} == "evbmips" -CLEANFILES+= algor sbmips -.elif ${MACHINE_CPU} == "aarch64" -CLEANFILES+= arm -.endif - -.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" -CLEANFILES+= xen xen-ma/machine # xen-ma -CPPFLAGS+= -I${.OBJDIR}/xen-ma -.if ${MACHINE_CPU} == "i386" -CLEANFILES+= x86 -.endif -.endif - -# XXX. This should be done a better way. It's @'d to reduce visual spew. -# XXX .BEGIN is used to make sure the links are done before anything else. -.if !make(obj) && !make(clean) && !make(cleandir) -.BEGIN: - -@rm -f machine && \ - ln -s $S/arch/${KLINK_MACHINE}/include machine - -@rm -f ${KLINK_MACHINE} && \ - ln -s $S/arch/${KLINK_MACHINE}/include ${KLINK_MACHINE} - -@if [ -d $S/arch/${MACHINE_CPU} ]; then \ - rm -f ${MACHINE_CPU} && \ - ln -s $S/arch/${MACHINE_CPU}/include ${MACHINE_CPU}; \ - fi -# XXX. it gets worse.. -.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" - -@rm -f sun68k && \ - ln -s $S/arch/sun68k/include sun68k -.endif -.if ${KLINK_MACHINE} == "sparc64" - -@rm -f sparc && \ - ln -s $S/arch/sparc/include sparc -.endif -.if ${KLINK_MACHINE} == "amd64" - -@rm -f i386 && \ - ln -s $S/arch/i386/include i386 -.endif -.if ${MACHINE_CPU} == "i386" || ${MACHINE_CPU} == "x86_64" - -@rm -f x86 && \ - ln -s $S/arch/x86/include x86 -.endif -.if ${MACHINE_CPU} == "aarch64" - -@rm -f arm && \ - ln -s $S/arch/arm/include arm -.endif -.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" - -@rm -f xen && \ - ln -s $S/arch/xen/include xen - -@rm -rf xen-ma && mkdir xen-ma && \ - ln -s ../${XEN_BUILD:U${MACHINE_ARCH}} xen-ma/machine -.endif -.if ${KLINK_MACHINE} == "evbmips" - -@rm -f algor && \ - ln -s $S/arch/algor/include algor - -@rm -f sbmips && \ - ln -s $S/arch/sbmips/include sbmips -.endif -.endif diff --git a/src/share/mk/bsd.kmodule.mk b/src/share/mk/bsd.kmodule.mk deleted file mode 100644 index 970bb6a..0000000 --- a/src/share/mk/bsd.kmodule.mk +++ /dev/null @@ -1,249 +0,0 @@ -# $NetBSD: bsd.kmodule.mk,v 1.55 2015/07/09 14:50:08 matt Exp $ - -# We are not building this with PIE -MKPIE=no - -.include -.include -.include - -##### Basic targets -realinstall: kmodinstall - -KERN= $S/kern -MKLDSCRIPT?= no - -CFLAGS+= -ffreestanding ${COPTS} -CPPFLAGS+= -nostdinc -I. -I${.CURDIR} -isystem $S -isystem $S/arch -CPPFLAGS+= -isystem ${S}/../common/include -CPPFLAGS+= -D_KERNEL -D_LKM -D_MODULE -DSYSCTL_INCLUDE_DESCR - -# XXX until the kernel is fixed again... -CFLAGS+= -fno-strict-aliasing -Wno-pointer-sign - -# XXX This is a workaround for platforms that have relative relocations -# that, when relocated by the module loader, result in addresses that -# overflow the size of the relocation (e.g. R_PPC_REL24 in powerpc). -# The real solution to this involves generating trampolines for those -# relocations inside the loader and removing this workaround, as the -# resulting code would be much faster. -.if ${MACHINE_CPU} == "arm" -CFLAGS+= -fno-common -fno-unwind-tables -.elif ${MACHINE_CPU} == "hppa" -CFLAGS+= -mlong-calls -.elif ${MACHINE_CPU} == "powerpc" -CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mlongcall :} -.elif ${MACHINE_CPU} == "vax" -CFLAGS+= -fno-pic -.elif ${MACHINE_CPU} == "riscv" -CFLAGS+= -fPIC -Wa,-fno-pic -.elif ${MACHINE_ARCH} == "mips64eb" && !defined(BSD_MK_COMPAT_FILE) -CFLAGS+= -mabi=64 -LDFLAGS+= -Wl,-m,elf64btsmip -.elif ${MACHINE_ARCH} == "mips64el" && !defined(BSD_MK_COMPAT_FILE) -CFLAGS+= -mabi=64 -LDFLAGS+= -Wl,-m,elf64ltsmip -.endif - -.if ${MACHINE_CPU} == "sparc64" -# force same memory model as rest of the kernel -CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :} -CFLAGS+= ${${ACTIVE_CC} == "clang":? -mcmodel=small :} -.endif - -# evbppc needs some special help -.if ${MACHINE} == "evbppc" - -. ifndef PPC_INTR_IMPL -PPC_INTR_IMPL=\"powerpc/intr.h\" -. endif -. ifndef PPC_PCI_MACHDEP_IMPL -PPC_PCI_MACHDEP_IMPL=\"powerpc/pci_machdep.h\" -. endif -CPPFLAGS+= -DPPC_INTR_IMPL=${PPC_INTR_IMPL} -CPPFLAGS+= -DPPC_PCI_MACHDEP_IMPL=${DPPC_PCI_MACHDEP_IMPL} - -. ifdef PPC_IBM4XX -CPPFLAGS+= -DPPC_IBM4XX -. elifdef PPC_BOOKE -CPPFLAGS+= -DPPC_BOOKE -. else -CPPFLAGS+= -DPPC_OEA -. endif - -.endif - - -_YKMSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} -DPSRCS+= ${_YKMSRCS} -CLEANFILES+= ${_YKMSRCS} - -.if exists($S/../sys/modules/xldscripts/kmodule) -KMODSCRIPTSRC= $S/../sys/modules/xldscripts/kmodule -.else -KMODSCRIPTSRC= ${DESTDIR}/usr/libdata/ldscripts/kmodule -.endif -.if ${MKLDSCRIPT} == "yes" -KMODSCRIPT= kldscript -MKLDSCRIPTSH= -.else -KMODSCRIPT= ${KMODSCRIPTSRC} -.endif - -PROG?= ${KMOD}.kmod - -##### Build rules -realall: ${PROG} - -.if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \ - && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE)) -.for f in ${SRCS:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g} -.if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \ - || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \ - || ${CXXFLAGS.$f:D5} == "5") \ - || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/})) -XOBJS+= ${f:R:S/$/.o/} -.else -XSRCS+= ${f} -NODPSRCS+= ${f} -.endif -.endfor - -.if !empty(XOBJS) -${XOBJS}: ${DPSRCS} -.endif - -.if ${MKLDSCRIPT} == "yes" -${KMODSCRIPT}: ${KMODSCRIPTSRC} ${XOBJS} $S/conf/mkldscript.sh - @rm -f ${.TARGET} - @OBJDUMP=${OBJDUMP} ${HOST_SH} $S/conf/mkldscript.sh \ - -t ${KMODSCRIPTSRC} ${XOBJS} > ${.TARGET} -.endif - -${PROG}: ${XOBJS} ${XSRCS} ${DPSRCS} ${DPADD} ${KMODSCRIPT} - ${CC} ${LDFLAGS} -nostdlib -MD -combine -r -Wl,-T,${KMODSCRIPT},-d \ - -Wl,-Map=${.TARGET}.map \ - -o ${.TARGET} ${CFLAGS} ${CPPFLAGS} ${XOBJS} \ - ${XSRCS:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} && \ - echo '.-include "${KMOD}.d"' > .depend - -.else -OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} - -${OBJS} ${LOBJS}: ${DPSRCS} - -.if ${MKLDSCRIPT} == "yes" -${KMODSCRIPT}: ${KMODSCRIPTSRC} ${OBJS} $S/conf/mkldscript.sh - @rm -f ${.TARGET} - @OBJDUMP=${OBJDUMP} ${HOST_SH} $S/conf/mkldscript.sh \ - -t ${KMODSCRIPTSRC} ${OBJS} > ${.TARGET} -.endif - -.if ${MACHINE_CPU} == "arm" -# The solution to limited branch space involves generating trampolines for -# those relocations while creating the module, as the resulting code will -# be much faster and simplifies the loader. -ARCHDIR= $S/modules/arch/${MACHINE_CPU} -ASM_H= $S/arch/${MACHINE_CPU}/include/asm.h -CLEANFILES+= tmp.o tmp.S ${KMOD}_tmp.o ${KMOD}_tramp.o ${KMOD}_tramp.S -${KMOD}_tmp.o: ${OBJS} ${DPADD} - ${_MKTARGET_LINK} - ${LD} -r -o tmp.o ${OBJS} - ${LD} -r \ - `${OBJDUMP} --syms --reloc tmp.o | \ - ${TOOL_AWK} -f ${ARCHDIR}/kmodwrap.awk` \ - -o ${.TARGET} tmp.o - -${KMOD}_tramp.S: ${KMOD}_tmp.o ${ARCHDIR}/kmodtramp.awk ${ASM_H} - ${_MKTARGET_CREATE} - ${OBJDUMP} --syms --reloc ${KMOD}_tmp.o | \ - ${TOOL_AWK} -f ${ARCHDIR}/kmodtramp.awk \ - > tmp.S && \ - mv tmp.S ${.TARGET} - -${PROG}: ${KMOD}_tmp.o ${KMOD}_tramp.o - ${_MKTARGET_LINK} -.if exists(${ARCHDIR}/kmodhide.awk) - ${LD} -r -Map=${.TARGET}.map \ - -o tmp.o ${KMOD}_tmp.o ${KMOD}_tramp.o - ${OBJCOPY} \ - `${NM} tmp.o | ${TOOL_AWK} -f ${ARCHDIR}/kmodhide.awk` \ - tmp.o ${.TARGET} && \ - rm tmp.o -.else - ${LD} -r -Map=${.TARGET}.map \ - -o ${.TARGET} ${KMOD}_tmp.o ${KMOD}_tramp.o -.endif -.else -${PROG}: ${OBJS} ${DPADD} ${KMODSCRIPT} - ${_MKTARGET_LINK} - ${CC} ${LDFLAGS} -nostdlib -r -Wl,-T,${KMODSCRIPT},-d \ - -Wl,-Map=${.TARGET}.map \ - -o ${.TARGET} ${OBJS} -.endif -.endif - -##### Install rules -.if !target(kmodinstall) -.if !defined(KMODULEDIR) -_OSRELEASE!= ${HOST_SH} $S/conf/osrelease.sh -k -# Ensure these are recorded properly in METALOG on unprived installes: -KMODULEARCHDIR?= ${MACHINE} -_INST_DIRS= ${DESTDIR}/stand/${KMODULEARCHDIR} -_INST_DIRS+= ${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE} -_INST_DIRS+= ${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules -KMODULEDIR= ${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules/${KMOD} -.endif -_PROG:= ${KMODULEDIR}/${PROG} # installed path - -.if ${MKUPDATE} == "no" -${_PROG}! ${PROG} # install rule -.if !defined(BUILD) && !make(all) && !make(${PROG}) -${_PROG}! .MADE # no build at install -.endif -.else -${_PROG}: ${PROG} # install rule -.if !defined(BUILD) && !make(all) && !make(${PROG}) -${_PROG}: .MADE # no build at install -.endif -.endif - ${_MKTARGET_INSTALL} - dirs=${_INST_DIRS:Q}; \ - for d in $$dirs; do \ - ${INSTALL_DIR} $$d; \ - done - ${INSTALL_DIR} ${KMODULEDIR} - ${INSTALL_FILE} -o ${KMODULEOWN} -g ${KMODULEGRP} -m ${KMODULEMODE} \ - ${.ALLSRC} ${.TARGET} - -kmodinstall:: ${_PROG} -.PHONY: kmodinstall -.PRECIOUS: ${_PROG} # keep if install fails - -.undef _PROG -.endif # !target(kmodinstall) - -##### Clean rules -CLEANFILES+= a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${LOBJS} -CLEANFILES+= ${PROG}.map -.if ${MKLDSCRIPT} == "yes" -CLEANFILES+= kldscript -.endif - -##### Custom rules -lint: ${LOBJS} -.if defined(LOBJS) && !empty(LOBJS) - ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD} -.endif - -##### Pull in related .mk logic -LINKSOWN?= ${KMODULEOWN} -LINKSGRP?= ${KMODULEGRP} -LINKSMODE?= ${KMODULEMODE} -.include -.include -.include -.include - -.-include "$S/arch/${MACHINE_CPU}/include/Makefile.inc" -.-include "$S/arch/${MACHINE}/include/Makefile.inc" diff --git a/src/share/mk/bsd.lib.mk b/src/share/mk/bsd.lib.mk deleted file mode 100644 index 73867e3..0000000 --- a/src/share/mk/bsd.lib.mk +++ /dev/null @@ -1,968 +0,0 @@ -# $NetBSD: bsd.lib.mk,v 1.362 2015/09/08 16:06:42 uebayasi Exp $ -# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 - -.include -.include -.include -# Pull in here so we can override its .c.o rule -.include - -LIBISMODULE?= no -LIBISPRIVATE?= no -LIBISCXX?= no - -.if ${LIBISMODULE} != "no" -_LIB_PREFIX?= # empty -MKDEBUGLIB:= no -MKLINT:= no -MKPICINSTALL:= no -MKPROFILE:= no -MKSTATICLIB:= no -.else -_LIB_PREFIX?= lib -.endif - -.if ${LIBISPRIVATE} != "no" -MKDEBUGLIB:= no -MKLINT:= no -MKPICINSTALL:= no -. if defined(NOSTATICLIB) && ${MKPICLIB} != "no" -MKSTATICLIB:= no -. else -MKPIC:= no -. endif -MKPROFILE:= no -.endif - -##### Basic targets -.PHONY: checkver libinstall -realinstall: checkver libinstall - -##### LIB specific flags. -# XXX: This is needed for programs that link with .a libraries -# Perhaps a more correct solution is to always generate _pic.a -# files or always have a shared library. -.if defined(MKPIE) && (${MKPIE} != "no") -CFLAGS+= ${PIE_CFLAGS} -AFLAGS+= ${PIE_AFLAGS} -.endif - -##### Libraries that this may depend upon. -.if defined(LIBDPLIBS) && ${MKPIC} != "no" # { -.for _lib _dir in ${LIBDPLIBS} -.if !defined(LIBDO.${_lib}) -LIBDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} -.MAKEOVERRIDES+=LIBDO.${_lib} -.endif -.if ${LIBDO.${_lib}} == "_external" -LDADD+= -l${_lib} -.else -LDADD+= -L${LIBDO.${_lib}} -l${_lib} -DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so # Don't use _LIB_PREFIX -.endif -.endfor -.endif # } - -##### Build and install rules -MKDEP_SUFFIXES?= .o .po .pico .go .ln .d - -.if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # { -SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major -SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor -SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny - -DPADD+= ${SHLIB_VERSION_FILE} - -# Check for higher installed library versions. -.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \ - exists(${NETBSDSRCDIR}/lib/checkver) -checkver: - @(cd "${.CURDIR}" && \ - HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \ - ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \ - -d ${_DEST.OBJ} ${LIB}) -.endif -.endif # } - -.if !target(checkver) -checkver: -.endif - -print-shlib-major: -.if defined(SHLIB_MAJOR) && ${MKPIC} != "no" - @echo ${SHLIB_MAJOR} -.else - @false -.endif - -print-shlib-minor: -.if defined(SHLIB_MINOR) && ${MKPIC} != "no" - @echo ${SHLIB_MINOR} -.else - @false -.endif - -print-shlib-teeny: -.if defined(SHLIB_TEENY) && ${MKPIC} != "no" - @echo ${SHLIB_TEENY} -.else - @false -.endif - -.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR) # { -.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR) -.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY) -SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY} -.else -SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} -.endif -.else -SHLIB_FULLVERSION=${SHLIB_MAJOR} -.endif -.endif # } - -# add additional suffixes not exported. -# .po is used for profiling object files. -# .pico is used for PIC object files. -.SUFFIXES: .out .a .ln .pico .po .go .o .s .S .c .cc .cpp .cxx .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. - -# Data-driven table using make variables to control how shared libraries -# are built for different platforms and object formats. -# SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version -# numbers of shared library -# 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_TEENY}]] -# 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 - -PICFLAGS ?= -fPIC - -.if ${MKPICLIB} != "no" -CSHLIBFLAGS+= ${PICFLAGS} -.endif - -.if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS) -MKSHLIBOBJS= yes -.else -MKSHLIBOBJS= no -.endif - -.if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \ - (defined(CFLAGS) && !empty(CFLAGS:M*-g*)) -# We only add -g to the shared library objects -# because we don't currently split .a archives. -CSHLIBFLAGS+= -g -.if ${LIBISPRIVATE} == "yes" -CFLAGS+= -g -.endif -.endif - -# Platform-independent linker flags for ELF shared libraries -SHLIB_SOVERSION= ${SHLIB_MAJOR} -SHLIB_SHFLAGS= -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION} -.if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no" -SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel -.endif -.if !defined(SHLIB_MKMAP) || ${SHLIB_MKMAP} != "no" -SHLIB_SHFLAGS+= -Wl,-Map=${_LIB}.so.${SHLIB_SOVERSION}.map -.endif -CLEANFILES+= ${_LIB}.so.${SHLIB_SOVERSION}.map -SHLIB_LDSTARTFILE?= ${_GCC_CRTI} ${_GCC_CRTBEGINS} -SHLIB_LDENDFILE?= ${_GCC_CRTENDS} ${_GCC_CRTN} - -CFLAGS+= ${COPTS} -OBJCFLAGS+= ${OBJCOPTS} -AFLAGS+= ${COPTS} -FFLAGS+= ${FOPTS} - -.if defined(CTFCONVERT) -.if defined(CFLAGS) && !empty(CFLAGS:M*-g*) -CTFFLAGS+= -g -.if defined(HAVE_GCC) && ${HAVE_GCC} >= 48 -#CFLAGS+= -gdwarf-2 -.endif -.endif -.endif - -LIBSTRIPAOBJS= yes -.if !defined(CFLAGS) || empty(CFLAGS:M*-g*) -LIBSTRIPCOBJS= yes -.endif -.if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*) -LIBSTRIPOBJCOBJS= yes -.endif -.if !defined(FFLAGS) || empty(FFLAGS:M*-g*) -LIBSTRIPFOBJS= yes -.endif -.if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*) -LIBSTRIPSHLIBOBJS= yes -.endif - -.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" -SHLIB_SHFLAGS+= -L ${DESTDIR}/usr/lib -SHLIB_SHFLAGS+= -Wl,-plugin=${GOLD_PLUGIN} \ - -Wl,-plugin-opt=-disable-opt - -SECTIONIFYPASS?=${NETBSDSRCDIR}/minix/llvm/bin/sectionify.so -# dcvmoole: the following construction is a hack for libmagicrt. For reasons -# not entirely under our control, clang refuses to take .bc objects even when -# using the gold linker, saying that LLVM IR code cannot be linked. In order -# to sidestep this, libmagicrt uses the name "foo.bc.o" instead of "foo.bc" to -# link the its LLVM IR objects. As all libmagicrt modules use the sectionify -# pass below, and this step needs temporary files, we give the temporary files -# the .o suffix (while anything would do!), and allow the libmagicrt makefile -# to override the rename to the real file name to perform a copy instead. As -# a result, libmagicrt ends up with both the .bc and .bc.o objects, and it can -# pass the latter set to clang, bypassing clang's overly strict checks. -SECTIONIFYMV?=mv -f - -.S.bc: ${.TARGET:.bc=.o} - rm -f ${.TARGET} - ln ${.TARGET:.bc=.o} ${.TARGET} -.c.bc: - ${_MKTARGET_COMPILE} - ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -flto - if [ -n '${SECTIONIFY.${.IMPSRC:T}:U${SECTIONIFY}}' ]; then \ - ${OPT} -load ${SECTIONIFYPASS} -sectionify ${SECTIONIFY.${.IMPSRC:T}:U${SECTIONIFY}} -o ${.TARGET}.o ${.TARGET} && ${SECTIONIFYMV} ${.TARGET}.o ${.TARGET}; \ - fi - -.cc.bc .cxx.bc .cpp.bc: - ${_MKTARGET_COMPILE} - ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -flto -.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" -.c.o: - ${_MKTARGET_COMPILE} - ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPCOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.c.po: - ${_MKTARGET_COMPILE} - ${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPCOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.c.go: - ${_MKTARGET_COMPILE} - ${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET} - -.c.pico: - ${_MKTARGET_COMPILE} - ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} -.if defined(LIBSTRIPSHLIBOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.cc.o .cpp.o .cxx.o .C.o: - ${_MKTARGET_COMPILE} - ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(LIBSTRIPCOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.cc.po .cpp.po .cxx.po .C.po: - ${_MKTARGET_COMPILE} - ${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET} -.if defined(LIBSTRIPCOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.cc.go .cpp.go .cxx.go .C.go: - ${_MKTARGET_COMPILE} - ${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET} - -.cc.pico .cpp.pico .cxx.pico .C.pico: - ${_MKTARGET_COMPILE} - ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} -.if defined(LIBSTRIPSHLIBOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.f.o: - ${_MKTARGET_COMPILE} - ${COMPILE.f} ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPFOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.f.po: - ${_MKTARGET_COMPILE} - ${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPFOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.f.go: - ${_MKTARGET_COMPILE} - ${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET} - -.f.pico: - ${_MKTARGET_COMPILE} - ${COMPILE.f} ${PICFLAGS} ${.IMPSRC} -o ${.TARGET} -.if defined(LIBSTRIPFOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.f.ln: - ${_MKTARGET_COMPILE} - @echo Skipping lint for Fortran libraries. - -.m.o: - ${_MKTARGET_COMPILE} - ${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPOBJCOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.m.po: - ${_MKTARGET_COMPILE} - ${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPOBJCOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.m.go: - ${_MKTARGET_COMPILE} - ${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(LIBSTRIPOBJCOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.m.pico: - ${_MKTARGET_COMPILE} - ${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(LIBSTRIPOBJCOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.s.o: - ${_MKTARGET_COMPILE} - ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPAOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.S.o: - ${_MKTARGET_COMPILE} - ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPAOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.s.po: - ${_MKTARGET_COMPILE} - ${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPAOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.S.po: - ${_MKTARGET_COMPILE} - ${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif -.if defined(LIBSTRIPAOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.s.go: - ${_MKTARGET_COMPILE} - ${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} - -.S.go: - ${_MKTARGET_COMPILE} - ${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} - -.s.pico: - ${_MKTARGET_COMPILE} - ${COMPILE.s} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(LIBSTRIPAOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -.S.pico: - ${_MKTARGET_COMPILE} - ${COMPILE.S} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -.if defined(LIBSTRIPAOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -# Declare a few variables to make our life easier later. -_LIB:=${_LIB_PREFIX}${LIB} -_LIB.a:=${_LIB}.a -_LIB_p.a:=${_LIB}_p.a -_LIB_g.a:=${_LIB}_g.a -_LIB_pic.a:=${_LIB}_pic.a -_LIB.ln:=llib-l${LIB}.ln -.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" -_LIB_bc.a:=${_LIB}_bc.a -.endif # defined(__MINIX) - -.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) -_LIB.so:=${_LIB}.so -_LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR} -_LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION} -_LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link -.if ${MKDEBUG} != "no" -_LIB.so.debug:=${_LIB.so.full}.debug -.endif -.endif - -_DEST.LIB:=${DESTDIR}${LIBDIR} -_DEST.OBJ:=${DESTDIR}${_LIBSODIR} -_DEST.LINT:=${DESTDIR}${LINTLIBDIR} -_DEST.DEBUG:=${DESTDIR}${DEBUGDIR}${LIBDIR} -_DEST.ODEBUG:=${DESTDIR}${DEBUGDIR}${_LIBSODIR} - -.if defined(LIB) # { -.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \ - || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no" -_LIBS=${_LIB.a} -.else -_LIBS= -.endif - -.if ${LIBISPRIVATE} != "no" \ - && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \ - && !defined(NOCOMBINE)) # { -.for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g} -COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5} -.if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f) -COMBINESRCS+= ${f} -NODPSRCS+= ${f} -.else -OBJS+= ${f:R:S/$/.o/} -.endif -.endfor - -.if !empty(COMBINESRCS) -OBJS+= ${_LIB}_combine.o -${_LIB}_combine.o: ${COMBINESRCS} - ${_MKTARGET_COMPILE} - ${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET} -.if defined(LIBSTRIPOBJS) - ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} -.endif - -CLEANFILES+= ${_LIB}_combine.d - -.if exists("${_LIB}_combine.d") -.include "${_LIB}_combine.d" -.endif -.endif # empty(XSRCS.${LIB}) -.else # } { -OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g} -.endif # } - -STOBJS+=${OBJS} - -LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} - -.if ${LIBISPRIVATE} != "no" -# No installation is required -libinstall:: -.endif - -.if ${MKDEBUGLIB} != "no" -_LIBS+=${_LIB_g.a} -GOBJS+=${OBJS:.o=.go} -DEBUGFLAGS?=-DDEBUG -.endif - -.if ${MKPROFILE} != "no" -_LIBS+=${_LIB_p.a} -POBJS+=${OBJS:.o=.po} -PROFFLAGS?=-DGPROF -DPROF -.endif - -.if ${MKPIC} != "no" # { -.if ${MKPICLIB} == "no" -.if ${MKSHLIBOBJS} != "no" -# make _pic.a, which isn't really pic, -# since it's needed for making shared lib. -# but don't install it. -SOLIB=${_LIB_pic.a} -SOBJS+=${OBJS:.o=.pico} -.else -SOLIB=${_LIB.a} -.endif -.else -SOLIB=${_LIB_pic.a} -_LIBS+=${SOLIB} -SOBJS+=${OBJS:.o=.pico} -.endif -.if defined(SHLIB_FULLVERSION) -_LIBS+=${_LIB.so.full} -.endif -.endif # } - -.if ${MKLINT} != "no" && !empty(LOBJS) -_LIBS+=${_LIB.ln} -.endif - -ALLOBJS= -.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \ - || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no" -ALLOBJS+=${STOBJS} -.endif -ALLOBJS+=${POBJS} ${SOBJS} -.if ${MKLINT} != "no" && !empty(LOBJS) -ALLOBJS+=${LOBJS} -.endif -.else # !defined(LIB) # } { -LOBJS= -SOBJS= -.endif # !defined(LIB) # } - -_YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} - -.if ${USE_BITCODE:Uno} == "yes" -.if defined(LIB) -_LIBS+=${_LIB_bc.a} -.endif -.endif # ${USE_BITCODE:Uno} == "yes" - -.NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS} - -realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug} - -MKARZERO?= ${MKREPRO:Uno} - -.if ${MKARZERO} == "yes" -_ARFL=crsD -_ARRANFL=sD -_INSTRANLIB= -.else -_ARFL=crs -_ARRANFL=s -.if ${USE_BITCODE:Uno} == "yes" -_INSTRANLIB=${empty(PRESERVE):?-a "${AR} --plugin ${GOLD_PLUGIN} -s":} -.else -_INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":} -.endif # ${USE_BITCODE:Uno} == "yes" -.endif - -# If you change this, please consider reflecting the change in -# the override in sys/rump/Makefile.rump. -.if !target(__archivebuild) -__archivebuild: .USE - ${_MKTARGET_BUILD} - rm -f ${.TARGET} - ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` -.endif - -.if !target(__archiveinstall) -__archiveinstall: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${_INSTRANLIB} ${.ALLSRC} ${.TARGET} -.endif - -__archivesymlinkpic: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET} - -DPSRCS+= ${_YLSRCS} -CLEANFILES+= ${_YLSRCS} - -${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS} - -.if ${USE_BITCODE:Uno} == "yes" - -.if !target(__archivebuildbc) -__archivebuildbc: .USE - ${_MKTARGET_BUILD} - rm -f ${.TARGET} - ${AR} ${_ARFL} --plugin ${GOLD_PLUGIN} ${.TARGET} ${.ALLSRC:M*bc} -.endif - -# LSC: Ignore libunwind in the bitcode archive, otherwise final linking chokes -# on libunwind hidden assembly symbols. -BCOBJS+=${OBJS:Nlibunwind.*:.o=.bc} -ALLOBJS+=${BCOBJS} -${_LIB_bc.a}:: ${BCOBJS} __archivebuildbc - -.endif # ${USE_BITCODE:Uno} == "yes" - -${_LIB.a}:: ${STOBJS} __archivebuild - -${_LIB_p.a}:: ${POBJS} __archivebuild - -${_LIB_pic.a}:: ${SOBJS} __archivebuild - -${_LIB_g.a}:: ${GOBJS} __archivebuild - - -_LIBLDOPTS= -.if ${SHLIBDIR} != "/usr/lib" -_LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ - -L=${SHLIBDIR} -.elif ${SHLIBINSTALLDIR} != "/usr/lib" -_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ - -L=${SHLIBINSTALLDIR} -.endif - -# gcc -shared now adds -lc automatically. For libraries other than libc and -# libgcc* we add as a dependency the installed shared libc. For libc and -# libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that -# -Xl,-nostdlib is not enough because we want to tell the compiler-driver not -# to add standard libraries, not the linker. -.if !defined(LIB) -.if !empty(LIBC_SO) -DPLIBC ?= ${DESTDIR}${LIBC_SO} -.endif -.else -.if ${LIB} != "c" && ${LIB:Mgcc*} == "" \ - && ${LIB} != "sys" && ${LIB} != "minc" && ${LIB} != "mthread" # Minix-specific libs -.if !empty(LIBC_SO) -DPLIBC ?= ${DESTDIR}${LIBC_SO} -.endif -.else -LDLIBC ?= -nodefaultlibs -.if ${HAVE_LIBGCC} == "yes" && (${LIB} == "c" || ${LIB} == "minc") -.if !defined(__MINIX) -LDADD+= -lgcc -.else -LDADD+= ${${ACTIVE_CC} == "gcc":? -lgcc:} -.if ${MACHINE_ARCH} == "earm" -LDADD+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:} -.endif # ${MACHINE_ARCH} == "earm" -.endif # !defined(__MINIX) -.endif -.endif -.endif - -.if ${LIBISCXX} != "no" -LIBCC:= ${CXX} -. if ${MKLIBCXX} == "yes" -LIBDPLIBS+= c++ ${.CURDIR}/../../../../../external/bsd/libc++/lib -. else -LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3 -. endif -.else -LIBCC:= ${CC} -.endif - -_LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}} -_LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}} - -_MAINLIBDEPS= ${SOLIB} ${DPADD} ${DPLIBC} \ - ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} - -.if defined(_LIB.so.debug) -${_LIB.so.debug}: ${_LIB.so.link} - ${_MKTARGET_CREATE} - ( ${OBJCOPY} --only-keep-debug \ - ${_LIB.so.link} ${_LIB.so.debug} \ - ) || (rm -f ${.TARGET}; false) -${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug} - ${_MKTARGET_CREATE} - ( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ - --add-gnu-debuglink=${_LIB.so.debug} \ - ${_LIB.so.link} ${_LIB.so.full} \ - ) || (rm -f ${.TARGET}; false) -${_LIB.so.link}: ${_MAINLIBDEPS} -.else # aka no MKDEBUG -${_LIB.so.full}: ${_MAINLIBDEPS} -.endif - ${_MKTARGET_BUILD} - rm -f ${.TARGET} - ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \ - ${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \ - -Wl,--whole-archive ${SOLIB} \ - -Wl,--no-whole-archive ${_LDADD.${_LIB}} -# We don't use INSTALL_SYMLINK here because this is just -# happening inside the build directory/objdir. XXX Why does -# this spend so much effort on libraries that aren't live??? XXX -# XXX Also creates dead symlinks until the .full rule runs -# above and creates the main link -.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ - "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" - ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp - mv -f ${_LIB.so.major}.tmp ${_LIB.so.major} -.endif - ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp - mv -f ${_LIB.so}.tmp ${_LIB.so} -.if ${MKSTRIPIDENT} != "no" - ${OBJCOPY} -R .ident ${.TARGET} -.endif - -.if !empty(LOBJS) # { -LLIBS?= -lc -${_LIB.ln}: ${LOBJS} - ${_MKTARGET_COMPILE} - rm -f ${.TARGET} -.if defined(DESTDIR) - ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS} -.else - ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS} -.endif -.endif # } - -lint: ${LOBJS} -.if defined(LOBJS) && !empty(LOBJS) - ${LINT} ${LINTFLAGS} ${LOBJS} -.endif - - -# If the number of entries in CLEANFILES is too large, then the -# commands in bsd.clean.mk encounter errors like "exec(/bin/sh) -# failed (Argument list too long)". Avoid that by splitting the -# files to clean into several lists using different variable names. -# __cleanuse is an internal target in bsd.clean.mk; the way we -# use it here mimics the way it's used by the clean target in -# bsd.clean.mk. -# -clean: libclean1 libclean2 libclean3 libclean4 libclean5 -libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1 -libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2 -libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3 -libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4 -libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5 -.if defined(__MINIX) -# MINIX: core conflicts with core/ in lib/liblwip -CLEANFILES+= a.out [Ee]rrs mklog *.core -.else -CLEANFILES+= a.out [Ee]rrs mklog core *.core -.endif # defined(__MINIX) -LIBCLEANFILES1+= ${_LIB.a} ${STOBJS} ${STOBJS:=.tmp} -LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS} ${POBJS:=.tmp} -LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS} ${GOBJS:=.tmp} -LIBCLEANFILES4+= ${_LIB_pic.a} -.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) -LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug} -.endif -LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp} -LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS} - -.if defined(__MINIX) -clean: libclean6 -libclean6: .PHONY .MADE __cleanuse LIBCLEANFILES6 -LIBCLEANFILES6+= ${_LIB_bc.a} ${BCOBJS} ${BCOBJS:=.tmp} -.endif - -.if !target(libinstall) # { -# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no -libinstall:: - -.if ${USE_BITCODE:Uno} == "yes" -libinstall:: ${_DEST.LIB}/bc/${_LIB.a} -.PRECIOUS: ${_DEST.LIB}/bc/${_LIB.a} - -.if ${MKUPDATE} == "no" -.if !defined(BUILD) && !make(all) && !make(${_LIB_bc.a}) -${_DEST.LIB}/bc/${_LIB.a}! .MADE -.endif -${_DEST.LIB}/bc/${_LIB.a}! ${_LIB_bc.a} __archiveinstall -.else -.if !defined(BUILD) && !make(all) && !make(${_LIB_bc.a}) -${_DEST.LIB}/bc/${_LIB.a}: .MADE -.endif -${_DEST.LIB}/bc/${_LIB.a}: ${_LIB_bc.a} __archiveinstall -.endif -.endif # ${USE_BITCODE:Uno} == "yes" - -.if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no" -libinstall:: ${_DEST.LIB}/${_LIB.a} -.PRECIOUS: ${_DEST.LIB}/${_LIB.a} - -.if ${MKUPDATE} == "no" -.if !defined(BUILD) && !make(all) && !make(${_LIB.a}) -${_DEST.LIB}/${_LIB.a}! .MADE -.endif -${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall -.else -.if !defined(BUILD) && !make(all) && !make(${_LIB.a}) -${_DEST.LIB}/${_LIB.a}: .MADE -.endif -${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall -.endif -.endif - -.if ${MKPROFILE} != "no" -libinstall:: ${_DEST.LIB}/${_LIB_p.a} -.PRECIOUS: ${_DEST.LIB}/${_LIB_p.a} - -.if ${MKUPDATE} == "no" -.if !defined(BUILD) && !make(all) && !make(${_LIB_p.a}) -${_DEST.LIB}/${_LIB_p.a}! .MADE -.endif -${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall -.else -.if !defined(BUILD) && !make(all) && !make(${_LIB_p.a}) -${_DEST.LIB}/${_LIB_p.a}: .MADE -.endif -${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall -.endif -.endif - -.if ${MKDEBUGLIB} != "no" -libinstall:: ${_DEST.LIB}/${_LIB_g.a} -.PRECIOUS: ${_DEST.LIB}/${_LIB_g.a} - -.if ${MKUPDATE} == "no" -.if !defined(BUILD) && !make(all) && !make(${_LIB_g.a}) -${_DEST.LIB}/${_LIB_g.a}! .MADE -.endif -${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall -.else -.if !defined(BUILD) && !make(all) && !make(${LIB_g.a}) -${_DEST.LIB}/${_LIB_g.a}: .MADE -.endif -${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall -.endif -.endif - -.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no" -libinstall:: ${_DEST.LIB}/${_LIB_pic.a} -.PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a} - -.if ${MKUPDATE} == "no" -.if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a}) -${_DEST.LIB}/${_LIB_pic.a}! .MADE -.endif -.if ${MKPICLIB} == "no" -${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic -.else -${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall -.endif -.else -.if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a}) -${_DEST.LIB}/${_LIB_pic.a}: .MADE -.endif -.if ${MKPICLIB} == "no" -${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic -.else -${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall -.endif -.endif -.endif - -.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) - -libinstall:: ${_DEST.OBJ}/${_LIB.so.full} -.PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full} - -.if ${MKUPDATE} == "no" -.if !defined(BUILD) && !make(all) && !make(${_LIB.so.full}) -${_DEST.OBJ}/${_LIB.so.full}! .MADE -.endif -${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full} -.else -.if !defined(BUILD) && !make(all) && !make(${_LIB.so.full}) -${_DEST.OBJ}/${_LIB.so.full}: .MADE -.endif -${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full} -.endif - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${.ALLSRC} ${.TARGET} -.if ${_LIBSODIR} != ${LIBDIR} - ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \ - ${_DEST.LIB}/${_LIB.so.full} -.endif -.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ - "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" - ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major} -.if ${_LIBSODIR} != ${LIBDIR} - ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \ - ${_DEST.LIB}/${_LIB.so.major} -.endif -.endif -.if ${MKLINKLIB} != "no" - ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so} -.if ${_LIBSODIR} != ${LIBDIR} - ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \ - ${_DEST.LIB}/${_LIB.so} -.endif -.endif -.endif - -.if defined(_LIB.so.debug) -libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug} -.PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug} - -${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug} - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \ - ${.ALLSRC} ${.TARGET} -.if ${_LIBSODIR} != ${LIBDIR} - ${INSTALL_SYMLINK} -l r ${_DEST.DEBUG}/${_LIB.so.debug} \ - ${_DEST.ODEBUG}/${_LIB.so.debug} -.endif -.endif - -.if ${MKLINT} != "no" && !empty(LOBJS) -libinstall:: ${_DEST.LINT}/${_LIB.ln} -.PRECIOUS: ${_DEST.LINT}/${_LIB.ln} - -.if ${MKUPDATE} == "no" -.if !defined(BUILD) && !make(all) && !make(${_LIB.ln}) -${_DEST.LINT}/${_LIB.ln}! .MADE -.endif -${_DEST.LINT}/${_LIB.ln}! ${_LIB.ln} -.else -.if !defined(BUILD) && !make(all) && !make(${_LIB.ln}) -${_DEST.LINT}/${_LIB.ln}: .MADE -.endif -${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln} -.endif - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${.ALLSRC} ${_DEST.LINT} -.endif -.endif # !target(libinstall) # } - -##### Pull in related .mk logic -LINKSOWN?= ${LIBOWN} -LINKSGRP?= ${LIBGRP} -LINKSMODE?= ${LIBMODE} -.include -.include -.include -.include -.include -.include -.include -.include - -${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.links.mk b/src/share/mk/bsd.links.mk deleted file mode 100644 index 067236d..0000000 --- a/src/share/mk/bsd.links.mk +++ /dev/null @@ -1,96 +0,0 @@ -# $NetBSD: bsd.links.mk,v 1.34 2009/04/10 16:16:12 apb Exp $ - -.include - -##### Basic targets -install: linksinstall - -##### Default values -LINKS?= -SYMLINKS?= -LINKSOWN?= ${BINOWN} -LINKSGRP?= ${BINGRP} -LINKSMODE?= ${NONBINMODE} - -__linkinstall: .USE - ${_MKSHMSG_INSTALL} ${.TARGET}; \ - ${_MKSHECHO} "${INSTALL_LINK} \ - -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \ - -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \ - -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \ - ${.ALLSRC} ${.TARGET}" && \ - ${INSTALL_LINK} \ - -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \ - -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \ - -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \ - ${.ALLSRC} ${.TARGET} - -##### Install rules -.PHONY: linksinstall -linksinstall:: realinstall -.if !empty(SYMLINKS) - @(set ${SYMLINKS}; \ - while test $$# -ge 2; do \ - l=$$1; shift; \ - t=${DESTDIR}$$1; shift; \ - if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ - [ "$$l" = "$$ttarg" ]; then \ - continue ; \ - fi ; \ - ${_MKSHMSG_INSTALL} $$t; \ - ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ - ${INSTALL_SYMLINK} $$l $$t; \ - done; ) -.endif - -.for _src _dst in ${LINKS} -_l:=${DESTDIR}${_src} -_t:=${DESTDIR}${_dst} - -# Handle case conflicts carefully, when _dst occurs -# more than once after case flattening -.if ${MKUPDATE} == "no" || ${LINKS:tl:M${_dst:tl:Q}:[\#]} > 1 -${_t}! ${_l} __linkinstall -.else -${_t}: ${_l} __linkinstall -.endif - -linksinstall:: ${_t} -.PRECIOUS: ${_t} -.endfor - -configinstall: configlinksinstall -.PHONY: configlinksinstall -configlinksinstall:: configfilesinstall -.if !empty(CONFIGSYMLINKS) - @(set ${CONFIGSYMLINKS}; \ - while test $$# -ge 2; do \ - l=$$1; shift; \ - t=${DESTDIR}$$1; shift; \ - if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ - [ "$$l" = "$$ttarg" ]; then \ - continue ; \ - fi ; \ - ${_MKSHMSG_INSTALL} $$t; \ - ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ - ${INSTALL_SYMLINK} $$l $$t; \ - done; ) -.endif - -.for _src _dst in ${CONFIGLINKS} -_l:=${DESTDIR}${_src} -_t:=${DESTDIR}${_dst} - -# Handle case conflicts carefully, when _dst occurs -# more than once after case flattening -.if ${MKUPDATE} == "no" || ${CONFIGLINKS:tl:M${_dst:tl:Q}:[\#]} > 1 -${_t}! ${_l} __linkinstall -.else -${_t}: ${_l} __linkinstall -.endif - -configlinksinstall:: ${_t} -.PRECIOUS: ${_t} -.endfor - -.include diff --git a/src/share/mk/bsd.lua.mk b/src/share/mk/bsd.lua.mk deleted file mode 100644 index cf33880..0000000 --- a/src/share/mk/bsd.lua.mk +++ /dev/null @@ -1,173 +0,0 @@ -# $NetBSD: bsd.lua.mk,v 1.7 2014/07/19 18:38:34 lneto Exp $ -# -# Build rules and definitions for Lua modules - -# -# Variables used -# -# LUA_VERSION currently installed version of Lua -# LUA_LIBDIR ${LIBDIR}/lua/${LUA_VERSION} -# -# LUA_MODULES list of Lua modules to build/installi -# LUA_DPLIBS shared library dependencies as per LIBDPLIBS -# -# LUA_SRCS.mod sources for each module (by default: "${mod:S/./_/g}.lua") -# -# DPADD additional dependencies for building modules -# DPADD.mod additional dependencies for a specific module -# -# -# HAVE_LUAC if defined, .lua source files will be compiled with ${LUAC} -# and installed as precompiled chunks for faster loading. Note -# that the luac file format is not yet standardised and may be -# subject to change. -# -# LUAC the luac compiler (by default: /usr/bin/luac) -# -# -# Notes: -# -# currently make(depend) and make(tags) do not support .lua sources; We -# add Lua sources to DPSRCS when HAVE_LUAC is defined and other language -# sources to SRCS for . -# -# other language support for other than C is incomplete -# -# C language sources are passed though lint, when MKLINT != "no" -# -# The Lua binary searches /usr/share/lua/5.1/ at this time and we could -# install .lua modules there which would mean slightly less duplication -# in compat builds. However, MKSHARE=no would prevent such modules from -# being installed so we just install everything under /usr/lib/lua/5.1/ -# - -.if !defined(_BSD_LUA_MK_) -_BSD_LUA_MK_=1 - -.include -.include -.include - -#__MINIX: Not always included -.include -.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" -LDFLAGS+= -L${DESTDIR}/usr/lib -.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" - -## -##### Basic targets -realinstall: .PHONY lua-install -realall: .PHONY lua-all -lint: .PHONY lua-lint - -lua-install: .PHONY - -lua-all: .PHONY - -lua-lint: .PHONY - -CLEANFILES+= a.out [Ee]rrs mklog core *.core - -## -##### Global variables -LUA_VERSION?= 5.3 -LUA_LIBDIR?= ${LIBDIR}/lua/${LUA_VERSION} -LUAC?= /usr/bin/luac - -## -##### Build rules - -# XX should these always be on? -CFLAGS+= -fPIC - -.SUFFIXES: .lua .luac -.lua.luac: - ${_MKTARGET_COMPILE} - ${LUAC} -o ${.TARGET} ${.IMPSRC} - -## -##### Libraries that modules may depend upon. -.for _lib _dir in ${LUA_DPLIBS} -.if !defined(LIBDO.${_lib}) -LIBDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} -.MAKEOVERRIDES+=LIBDO.${_lib} -.endif -LDADD+=-L${LIBDO.${_lib}} -l${_lib} -DPADD+=${LIBDO.${_lib}}/lib${_lib}.so -.endfor - -## -##### Lua Modules -.for _M in ${LUA_MODULES} -LUA_SRCS.${_M}?=${_M:S/./_/g}.lua -LUA_DEST.${_M}=${LUA_LIBDIR}${_M:S/./\//g:S/^/\//:H} - -.if !empty(LUA_SRCS.${_M}:M*.lua) -.if ${LUA_SRCS.${_M}:[\#]} > 1 -.error Module "${_M}" has too many source files -.endif -.if defined(HAVE_LUAC) -## -## The module has Lua source and needs to be compiled -LUA_TARG.${_M}=${_M:S/./_/g}.luac -LUA_NAME.${_M}=${_M:S/./\//g:T}.luac -CLEANFILES+=${LUA_TARG.${_M}} -DPSRCS+=${LUA_SRCS.${_M}} - -.NOPATH: ${LUA_TARG.${_M}} -lua-all: ${LUA_TARG.${_M}} -${LUA_TARG.${_M}}: ${LUA_SRCS.${_M}} ${DPADD} ${DPADD.${_M}} -.else -## -## The module has Lua source and can be installed directly -LUA_TARG.${_M}=${LUA_SRCS.${_M}} -LUA_NAME.${_M}=${_M:S/./\//g:T}.lua -.endif -.else -## -## The module has other language source and we must build ${_M}.so -LUA_OBJS.${_M}=${LUA_SRCS.${_M}:N*.lua:R:S/$/.o/g} -LUA_LOBJ.${_M}=${LUA_SRCS.${_M}:M*.c:.c=.ln} -LUA_TARG.${_M}=${_M:S/./_/g}.so -LUA_NAME.${_M}=${_M:S/./\//g:T}.so -CLEANFILES+=${LUA_OBJS.${_M}} ${LUA_LOBJ.${_M}} ${LUA_TARG.${_M}} -DPSRCS+=${LUA_SRCS.${_M}} -SRCS+=${LUA_SRCS.${_M}} - -.NOPATH: ${LUA_OBJS.${_M}} ${LUA_LOBJ.${_M}} ${LUA_TARG.${_M}} -.if ${MKLINT} != "no" -${LUA_TARG.${_M}}: ${LUA_LOBJ.${_M}} -.endif -lua-lint: ${LUA_LOBJ.${_M}} -lua-all: ${LUA_TARG.${_M}} -${LUA_TARG.${_M}}: ${LUA_OBJS.${_M}} ${DPADD} ${DPADD.${_M}} - ${_MKTARGET_BUILD} - rm -f ${.TARGET} - ${CC} -Wl,--warn-shared-textrel \ - -Wl,-x -shared ${LUA_OBJS.${_M}} \ - -Wl,-soname,${LUA_NAME.${_M}} -o ${.TARGET} \ - ${LDADD} ${LDADD.${_M}} ${LDFLAGS} ${LDFLAGS.${_M}} - -.endif - -DPADD+= ${LIBLUA} -LDADD+= -llua - -## -## module install rules -lua-install: ${DESTDIR}${LUA_DEST.${_M}}/${LUA_NAME.${_M}} -${DESTDIR}${LUA_DEST.${_M}}/${LUA_NAME.${_M}}! ${LUA_TARG.${_M}} - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${.ALLSRC} ${.TARGET} - -.endfor -## -##### end of modules - -.include -.include -.include -.include -.include -.endif # ! defined(_BSD_LUA_MK_) diff --git a/src/share/mk/bsd.man.mk b/src/share/mk/bsd.man.mk deleted file mode 100644 index 0e557ef..0000000 --- a/src/share/mk/bsd.man.mk +++ /dev/null @@ -1,302 +0,0 @@ -# $NetBSD: bsd.man.mk,v 1.117 2014/12/19 22:25:39 christos Exp $ -# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93 - -.include - -##### Basic targets -.PHONY: catinstall maninstall catpages manpages catlinks manlinks -.PHONY: htmlinstall htmlpages htmllinks -.PHONY: lintmanpages -realinstall: ${MANINSTALL} - -# If our install destination is case-preserving, but case-insensitive -# then we do filesystem comparisons in lower case to make sure that -# we always refresh the target when needed. In general we don't -# want to do this, otherwise things like _exit.2 -> _Exit.2 get -# installed on each build even when they don't need to. Note that -# the CASE_INSENSITIVE_DEST macro is currently not defined anywhere, -# and the expansion does not really work because of make(1). -.if defined(CASE_INSENSITIVE_DEST) -_FLATTEN?=tl: -.endif - -##### Default values -.if ${USETOOLS} == "yes" -TMACDEPDIR?= ${TOOLDIR}/share/groff/tmac -.else -TMACDEPDIR?= /usr/share/tmac -.endif - -HTMLDIR?= ${DESTDIR}${MANDIR} -.if ${MKMANDOC} == yes && !defined(NOMANDOC) -CATDEPS?= -.else -CATDEPS?= ${TMACDEPDIR}/andoc.tmac \ - ${TMACDEPDIR}/doc.tmac \ - ${TMACDEPDIR}/mdoc/doc-common \ - ${TMACDEPDIR}/mdoc/doc-ditroff \ - ${TMACDEPDIR}/mdoc/doc-nroff \ - ${TMACDEPDIR}/mdoc/doc-syms -.endif -MANTARGET?= cat - -MAN?= -MLINKS?= -_MSECTIONS= 1 2 3 4 5 6 7 8 9 -_MSECTIONS+= 3lua 9lua -_MSECTIONREGEX= ${_MSECTIONS:ts|} # e.g. 1|2|3|... -.SUFFIXES: ${_MSECTIONS:@N@.$N@} - -.if ${MKMANZ} == "no" -MANCOMPRESS?= -MANSUFFIX?= -.else -MANCOMPRESS?= ${TOOL_GZIP_N} -cf -MANSUFFIX?= .gz -.endif - -# make MANCOMPRESS a filter, so it can be inserted on an as-needed basis -.if !empty(MANCOMPRESS) -MANCOMPRESS:= | ${MANCOMPRESS} -.endif - -__installpage: .USE - @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ - (${_MKSHMSG_INSTALL} ${.TARGET}; \ - ${_MKSHECHO} "${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ - ${.ALLSRC} ${.TARGET}" && \ - ${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ - ${.ALLSRC} ${.TARGET}) - -# XXX consider including bsd.links.mk and using __linkinstall instead -__linkinstallpage: .USE - ${_MKSHMSG_INSTALL} ${.TARGET}; \ - ${_MKSHECHO} "${INSTALL_LINK} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ - ${.ALLSRC} ${.TARGET}" && \ - ${INSTALL_LINK} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ - ${.ALLSRC} ${.TARGET} - -##### Build and install rules (source form pages) - -.if ${MKMAN} != "no" -maninstall: manpages manlinks -manpages:: # ensure target exists -MANPAGES= ${MAN:C/.$/&${MANSUFFIX}/} - -realall: ${MANPAGES} -.if !empty(MANSUFFIX) -.NOPATH: ${MANPAGES} -.SUFFIXES: ${_MSECTIONS:@N@.$N${MANSUFFIX}@} - -${_MSECTIONS:@N@.$N.$N${MANSUFFIX}@}: # build rule - ${_MKTARGET_FORMAT} - cat ${.IMPSRC} ${MANCOMPRESS} > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} -.endif # !empty(MANSUFFIX) - -.for F in ${MANPAGES:S/${MANSUFFIX}$//:O:u} -_F:= ${DESTDIR}${MANDIR}/man${F:T:E}${MANSUBDIR}/${F}${MANSUFFIX} - -.if ${MKUPDATE} == "no" -${_F}! ${F}${MANSUFFIX} __installpage # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}! .MADE # no build at install -.endif -.else -${_F}: ${F}${MANSUFFIX} __installpage # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}: .MADE # no build at install -.endif -.endif - -manpages:: ${_F} -.PRECIOUS: ${_F} # keep if install fails -.endfor - -manlinks:: # link install - -.for _src _dst in ${MLINKS} -_l:=${DESTDIR}${MANDIR}/man${_src:T:E}${MANSUBDIR}/${_src}${MANSUFFIX} -_t:=${DESTDIR}${MANDIR}/man${_dst:T:E}${MANSUBDIR}/${_dst}${MANSUFFIX} - -# Handle case conflicts carefully, when _dst occurs -# more than once after case flattening -.if ${MKUPDATE} == "no" || ${MLINKS:${_FLATTEN}M${_dst:${_FLATTEN}Q}:[\#]} > 1 -${_t}! ${_l} __linkinstallpage -.else -${_t}: ${_l} __linkinstallpage -.endif - -manlinks:: ${_t} -.PRECIOUS: ${_t} -.endfor -.endif # ${MKMAN} != "no" - -##### Build and install rules (plaintext pages) - -.if (${MKCATPAGES} != "no") && (${MKMAN} != "no") -catinstall: catpages catlinks -catpages:: # ensure target exists -CATPAGES= ${MAN:C/\.(${_MSECTIONREGEX})\$/.cat\1${MANSUFFIX}/} - -realall: ${CATPAGES} -.NOPATH: ${CATPAGES} -.SUFFIXES: ${_MSECTIONS:@N@.cat$N${MANSUFFIX}@} -.MADE: ${CATDEPS} - -${_MSECTIONS:@N@.$N.cat$N${MANSUFFIX}@}: ${CATDEPS} # build rule - ${_MKTARGET_FORMAT} -.if ${MKMANDOC} == yes && !defined(NOMANDOC) - if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \ - ${TOOL_MANDOC_ASCII} ${.IMPSRC} ${MANCOMPRESS} \ - > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \ - else \ - ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \ - > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \ - fi -.elif defined(USETBL) - ${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_ASCII} -mandoc ${MANCOMPRESS} \ - > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} -.else - ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \ - > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} -.endif - -.for F in ${CATPAGES:S/${MANSUFFIX}$//:O:u} -_F:= ${DESTDIR}${MANDIR}/${F:T:E}${MANSUBDIR}/${F:R}.0${MANSUFFIX} - -.if ${MKUPDATE} == "no" -${_F}! ${F}${MANSUFFIX} __installpage # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}! .MADE # no build at install -.endif -.else -${_F}: ${F}${MANSUFFIX} __installpage # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}: .MADE # no build at install -.endif -.endif - -catpages:: ${_F} -.PRECIOUS: ${_F} # keep if install fails -.endfor - -catlinks:: # link install - -.for _src _dst in ${MLINKS} -_l:=${DESTDIR}${MANDIR}/cat${_src:T:E}${MANSUBDIR}/${_src:R}.0${MANSUFFIX} -_t:=${DESTDIR}${MANDIR}/cat${_dst:T:E}${MANSUBDIR}/${_dst:R}.0${MANSUFFIX} - -# Handle case conflicts carefully, when _dst occurs -# more than once after case flattening -.if ${MKUPDATE} == "no" || ${MLINKS:${_FLATTEN}M${_dst:${_FLATTEN}Q}:[\#]} > 1 -${_t}! ${_l} __linkinstallpage -.else -${_t}: ${_l} __linkinstallpage -.endif - -catlinks:: ${_t} -.PRECIOUS: ${_t} -.endfor -.endif # (${MKCATPAGES} != "no") && (${MKMAN} != "no") - -##### Build and install rules (HTML pages) - -.if (${MKHTML} != "no") && (${MKMAN} != "no") # { -htmlinstall: htmlpages htmllinks -htmlpages:: # ensure target exists -HTMLPAGES= ${MAN:C/\.(${_MSECTIONREGEX})\$/.html\1/} - -HTMLLINKS= ${MANSUBDIR:?../:}../html%S/%N.html -HTMLSTYLE= ${MANSUBDIR:?../:}../style.css - -realall: ${HTMLPAGES} -.NOPATH: ${HTMLPAGES} -.SUFFIXES: ${_MSECTIONS:@N@.html$N@} - -${_MSECTIONS:@N@.$N.html$N@}: # build rule - ${_MKTARGET_FORMAT} -.if ${MKMANDOC} == yes && !defined(NOMANDOC) - if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \ - ${TOOL_MANDOC_HTML} -Oman=${HTMLLINKS} -Ostyle=${HTMLSTYLE} \ - ${.IMPSRC} > ${.TARGET}.tmp && \ - mv ${.TARGET}.tmp ${.TARGET}; \ - else \ - ${TOOL_ROFF_HTML} ${.IMPSRC} ${MANCOMPRESS} \ - > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \ - fi -.elif defined(USETBL) - ${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_HTML} ${MANCOMPRESS} \ - > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} -.else - ${TOOL_ROFF_HTML} ${.IMPSRC} ${MANCOMPRESS} \ - > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} -.endif - -.for F in ${HTMLPAGES:O:u} -# construct installed path -_F:= ${HTMLDIR}/${F:T:E}${MANSUBDIR}/${F:R:S-/index$-/x&-}.html - -.if ${MKUPDATE} == "no" -${_F}! ${F} __installpage # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}! .MADE # no build at install -.endif -.else -${_F}: ${F} __installpage # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}: .MADE # no build at install -.endif -.endif - -htmlpages:: ${_F} -.PRECIOUS: ${_F} # keep if install fails -.endfor - -htmllinks:: # link install - -.for _src _dst in ${MLINKS} -_l:=${HTMLDIR}/html${_src:T:E}${MANSUBDIR}/${_src:R:S-/index$-/x&-}.html -_t:=${HTMLDIR}/html${_dst:T:E}${MANSUBDIR}/${_dst:R:S-/index$-/x&-}.html - -# Handle case conflicts carefully, when _dst occurs -# more than once after case flattening -.if ${MKUPDATE} == "no" || ${MLINKS:${_FLATTEN}M${_dst:${_FLATTEN}Q}:[\#]} > 1 -${_t}! ${_l} __linkinstallpage -.else -${_t}: ${_l} __linkinstallpage -.endif - -htmllinks:: ${_t} -.PRECIOUS: ${_t} -.endfor - -.endif # } - -##### Clean rules -.undef _F - -.if !empty(MAN) && (${MKMAN} != "no") -.if (${MKCATPAGES} != "no") -CLEANDIRFILES+= ${CATPAGES} -.endif -.if !empty(MANSUFFIX) -CLEANDIRFILES+= ${MANPAGES} ${CATPAGES:S/${MANSUFFIX}$//} -.endif -.if ${MKHTML} != "no" -CLEANDIRFILES+= ${HTMLPAGES} -.endif -.endif -# (XXX ${CATPAGES:S...} cleans up old .catN files where .catN.gz now used) - -.if !empty(MANPAGES) -lintmanpages: ${MANPAGES} - ${TOOL_MANDOC_LINT} -Tlint -fstrict -Wall,stop ${.ALLSRC} -.endif - -##### Pull in related .mk logic -.include -.include -.include -.include - -${TARGETS} catinstall maninstall htmlinstall: # ensure existence diff --git a/src/share/mk/bsd.nls.mk b/src/share/mk/bsd.nls.mk deleted file mode 100644 index 0fefdbe..0000000 --- a/src/share/mk/bsd.nls.mk +++ /dev/null @@ -1,71 +0,0 @@ -# $NetBSD: bsd.nls.mk,v 1.47 2011/09/10 16:57:35 apb Exp $ - -.include - -##### Basic targets -realinstall: nlsinstall - -##### Default values -NLSNAME?= ${PROG:Ulib${LIB}} - -NLS?= - -##### Build rules -.if ${MKNLS} != "no" - -NLSALL= ${NLS:.msg=.cat} - -realall: ${NLSALL} -.NOPATH: ${NLSALL} - -.SUFFIXES: .cat .msg - -.msg.cat: - @rm -f ${.TARGET} - ${_MKTARGET_CREATE} - ${TOOL_GENCAT} ${.TARGET} ${.IMPSRC} - -.endif # ${MKNLS} != "no" - -##### Install rules -nlsinstall:: # ensure existence -.PHONY: nlsinstall - -.if ${MKNLS} != "no" - -__nlsinstall: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} \ - ${.ALLSRC} ${.TARGET} - -.for F in ${NLSALL:O:u} -_F:= ${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat # installed path - -.if ${MKUPDATE} == "no" -${_F}! ${F} __nlsinstall # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}! .MADE # no build at install -.endif -.else -${_F}: ${F} __nlsinstall # install rule -.if !defined(BUILD) && !make(all) && !make(${F}) -${_F}: .MADE # no build at install -.endif -.endif - -nlsinstall:: ${_F} -.PRECIOUS: ${_F} # keep if install fails -.endfor - -.undef _F -.endif # ${MKNLS} != "no" - -##### Clean rules -.if ${MKNLS} != "no" && !empty(NLS) -CLEANDIRFILES+= ${NLSALL} -.endif - -##### Pull in related .mk logic -.include -.include -.include diff --git a/src/share/mk/bsd.obj.mk b/src/share/mk/bsd.obj.mk deleted file mode 100644 index fb141d0..0000000 --- a/src/share/mk/bsd.obj.mk +++ /dev/null @@ -1,109 +0,0 @@ -# $NetBSD: bsd.obj.mk,v 1.49 2010/01/25 00:43:00 christos Exp $ - -.if !defined(_BSD_OBJ_MK_) -_BSD_OBJ_MK_=1 - -.include - -__curdir:= ${.CURDIR} - -.if ${MKOBJ} == "no" -obj: -.else -.if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR) -.if defined(MAKEOBJDIRPREFIX) -__objdir:= ${MAKEOBJDIRPREFIX}${__curdir} -.else -__objdir:= ${MAKEOBJDIR} -.endif -# MAKEOBJDIR and MAKEOBJDIRPREFIX are env variables supported -# by make(1). We simply mkdir -p the specified path. -# If that fails - we do a mkdir to get the appropriate error message -# before bailing out. -obj: -.if defined(MAKEOBJDIRPREFIX) - @if [ ! -d ${MAKEOBJDIRPREFIX} ]; then \ - echo "MAKEOBJDIRPREFIX ${MAKEOBJDIRPREFIX} does not exist, bailing..."; \ - exit 1; \ - fi; -.endif - @if [ ! -d ${__objdir} ]; then \ - mkdir -p ${__objdir}; \ - if [ ! -d ${__objdir} ]; then \ - mkdir ${__objdir}; exit 1; \ - fi; \ - ${_MKSHMSG} " objdir ${__objdir}"; \ - fi -.else -PAWD?= /bin/pwd - -__objdir= obj${OBJMACHINE:D.${MACHINE}} - -__usrobjdir= ${BSDOBJDIR}${USR_OBJMACHINE:D.${MACHINE}} -__usrobjdirpf= ${USR_OBJMACHINE:D:U${OBJMACHINE:D.${MACHINE}}} - -.if defined(BUILDID) -__objdir:= ${__objdir}.${BUILDID} -__usrobjdirpf:= ${__usrobjdirpf}.${BUILDID} -__need_objdir_target=yes -.endif - -.if defined(OBJHOSTMACHINE) && (${MKHOSTOBJ:Uno} != "no") -# In case .CURDIR has been twiddled by a .mk file and is now relative, -# make it absolute again. -.if ${__curdir:M/*} == "" -__curdir!= cd "${__curdir}" && ${PAWD} -.endif - -__objdir:= ${__objdir}.${HOST_OSTYPE} -__usrobjdirpf:= ${__usrobjdirpf}.${HOST_OSTYPE} -__need_objdir_target=yes -.endif - -.if defined(__need_objdir_target) -# Get make to change its internal definition of .OBJDIR -.OBJDIR: ${__objdir} -.endif - -obj: - @cd "${__curdir}"; \ - here=`${PAWD}`/; subdir=$${here#${BSDSRCDIR}/}; \ - if [ "$$here" != "$$subdir" ]; then \ - if [ ! -d ${__usrobjdir} ]; then \ - echo "BSDOBJDIR ${__usrobjdir} does not exist, bailing..."; \ - exit 1; \ - fi; \ - subdir=$${subdir%/}; \ - dest=${__usrobjdir}/$$subdir${__usrobjdirpf}; \ - if [ -x ${TOOL_STAT} ] && \ - ttarg=`${TOOL_STAT} -qf '%Y' $${here}${__objdir}` && \ - [ "$$dest" = "$$ttarg" ]; then \ - : ; \ - else \ - ${_MKSHMSG} " objdir $$dest"; \ - rm -rf ${__objdir}; \ - ln -s $$dest ${__objdir}; \ - fi; \ - if [ ! -d $$dest ]; then \ - mkdir -p $$dest; \ - else \ - true; \ - fi; \ - else \ - true ; \ - dest=$${here}${__objdir} ; \ - if [ ! -d ${__objdir} ] || [ -h ${__objdir} ]; then \ - ${_MKSHMSG} " objdir $$dest"; \ - rm -f ${__objdir}; \ - mkdir $$dest; \ - fi ; \ - fi; -.endif -.endif - -print-objdir: - @echo ${.OBJDIR} - -.include - -.endif # !defined(_BSD_OBJ_MK_) diff --git a/src/share/mk/bsd.own.mk b/src/share/mk/bsd.own.mk deleted file mode 100644 index f76d5f8..0000000 --- a/src/share/mk/bsd.own.mk +++ /dev/null @@ -1,1733 +0,0 @@ -# $NetBSD: bsd.own.mk,v 1.874 2015/09/30 22:58:02 rjs Exp $ - -# This needs to be before bsd.init.mk -.if defined(BSD_MK_COMPAT_FILE) -.include <${BSD_MK_COMPAT_FILE}> -.endif - -.if !defined(_BSD_OWN_MK_) -_BSD_OWN_MK_=1 - -.if defined(__MINIX) - -# Some Minix deviations from NetBSD -LDSTATIC?= -static -MKDYNAMICROOT?= no -NO_LIBGOMP?= yes - -BINMODE?= 755 -NONBINMODE?= 644 -MANDIR?= /usr/man - -MKKYUA?= yes -MKMCLINKER?= no -MKCLANGRT?= no -MKGCC?= no -MKGCCCMDS?= no -MKPROFILE?= no -MKSLJIT?= no - -#MINIX-specific variables -MKCOVERAGE?= no - -# LSC MINIX does not support these features ATM. -USE_FORT:= no -USE_SSP:= no -MKCOMPAT:= no -MKGDB:= no -MKGROFF:= no -MKHESIOD:= no -MKHTML:= no -MKIPFILTER:= no -MKISCSI:= no -MKKERBEROS:= no -MKKMOD:= no -MKLDAP:= no -MKLINT:= no -MKLVM:= no -MKMDNS:= no -MKNPF:= no -MKPAM:= no -MKPF:= no -MKPOSTFIX:= no -MKRUMP:= no -MKSKEY:= no -MKYP:= no -MKCROSSGDB:= no - -WEAKALIASOVERRIDEPASS?=${NETBSDSRCDIR}/minix/llvm/bin/weak-alias-module-override.so -GOLD_PLUGIN?=${NETBSDSRCDIR}/minix/llvm/bin/LLVMgold.so - -# By default when running LLVM passes: -# - do not run optimization while running LLVM passes -# - run the passe which allows assembly weak symbols to be -# overriden by bitcode functions -OPTFLAGS?= -disable-opt \ - -disable-inlining \ - -load ${WEAKALIASOVERRIDEPASS} -weak-alias-module-override - -BITCODE_LD_FLAGS_1ST?= \ - -Wl,-plugin=${GOLD_PLUGIN} \ - -Wl,-plugin-opt=-disable-opt \ - -Wl,-plugin-opt=-disable-inlining - -BITCODE_LD_FLAGS_2ND?=${BITCODE_LD_FLAGS_1ST} - -.ifdef CONFIG_SMP -SMP_FLAGS += -DCONFIG_SMP -.ifdef CONFIG_MAX_CPUS -SMP_FLAGS += -DCONFIG_MAX_CPUS=${CONFIG_MAX_CPUS} -.endif -.endif - -CPPFLAGS+= ${SMP_FLAGS} - -__uname_s!= uname -s -.if ${__uname_s:Uunknown} == "Minix" -USETOOLS?= never -. if ${USETOOLS:Uno} != "yes" - HAVE_LLVM?= yes - -# If DESTDIR was specified, and we are not using the tools, then make sure to -# build out-of-tree and to refer only DESTDIR for target binaries -# The case when using tools is already handled below. -. if ${DESTDIR:U} != "" - CPPFLAGS+= --sysroot=${DESTDIR} - LDFLAGS+= --sysroot=${DESTDIR} -. endif # ${DESTDIR:U} != "" - - MKTOOLS?=no -. endif # ${USETOOLS:Uno} != "yes" - -. if !defined(HOSTPROG) && !defined(HOSTLIB) -# LSC FIXME: Override MACHINE as the native minix host make command will set -# it to i686. -. if ${MACHINE_ARCH} == "i386" - MACHINE:= i386 -. endif -# LSC FIXME: On a native ARM system MACHINE_ARCH is earmv7 instead of earm... -. if !empty(MACHINE_ARCH:Mearm*) - MACHINE_ARCH:= earm -. endif -. endif # !defined(HOSTPROG) && !defined(HOSTLIB) -.endif # __uname_s == "Minix" - -# LSC FIXME: RELEASEMACHINEDIR is set to evbarm, instead of evbearm-el -.if !empty(MACHINE:Mevbarm*) -RELEASEMACHINEDIR:= evbearm-el -.endif - -.if ${HAVE_GCC:Dyes} == "yes" || \ - (${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no") -# We are building with GCC, means we cannot build LIBCXX, and need LIBSTDCXX -MKLIBCXX?= no # Can't compile with GCC. - -. if ${USETOOLS:Uno} == "yes" || ${MKLIBSTDCXX:Uno} == "yes" -# When cross-compiling, or building MKLIBSTDCXX, use the in-tree LIBSTDCXX -MKLIBSTDCXX?= yes -CXXFLAGS+= -I${DESTDIR}/usr/include/g++ -. endif # ${USETOOLS:Uno} == "yes" - -. if ${MKLIBSTDCXX:Uno} == "no" -# Specify the C++ system header for the host libstdc++, as we are not building -# LIBSTDCXX -CXXFLAGS+= -I/usr/include/g++ -. endif # ${MKLIBSTDCXX:Uno} == "no" - -.endif # ${HAVE_GCC:Dyes} == "yes" || \ - # (${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no") - -# MKGCCCMDS == yes implies MKGCC == yes -.if ${MKGCCCMDS} == "yes" -MKGCC= yes -MKBINUTILS?= yes # We are installing GCC, so trigger binutils. -MKLIBSTDCXX?= yes # Also install the GNU C++ library -.endif # ${MKGCCCMDS} == "yes" - -# The default value of MKLIBSTDCXX cannot be set before the previous test. -MKLIBSTDCXX?= no - -.if ${MKGCC} == "yes" -HAVE_GCC?= 5 # Not really, but that's the setting. -HAVE_LIBGCC?= yes -HAVE_LIBGCC_EH?= yes -.endif # ${MKGCC} == "yes" - -.if ${USETOOLS:Uno} == "yes" -MKLLVM?= yes -.endif # ${USETOOLS:Uno} == "yes" - -.if ${MKLLVM:Uno} == "yes" -HAVE_LLVM?= yes -MKBINUTILS?= yes # We are installing clang, so trigger binutils. -.endif # ${MKLLVM:Uno} == "yes" - -.if ${HAVE_LLVM:Dyes} == "yes" -HAVE_LIBGCC?= no -.endif # ${HAVE_LLVM:Dyes} == "yes" - -# The default value has to be set after we have figured out if we are using GCC -# or not. -MKLIBCXX?= yes # Build by default libc++ - -# The default value of MKBINUTILS cannot be set before the previous test. -MKBINUTILS?= no - -.endif # defined(__MINIX) - -MAKECONF?= /etc/mk.conf -.-include "${MAKECONF}" - -# -# CPU model, derived from MACHINE_ARCH -# -MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:C/arm.*/arm/:C/earm.*/arm/:S/earm/arm/:S/powerpc64/powerpc/:S/aarch64eb/aarch64/:S/or1knd/or1k/:C/riscv../riscv/} - -# -# Subdirectory used below ${RELEASEDIR} when building a release -# -RELEASEMACHINEDIR?= ${MACHINE} - -# -# Subdirectory or path component used for the following paths: -# distrib/${RELEASEMACHINE} -# distrib/notes/${RELEASEMACHINE} -# etc/etc.${RELEASEMACHINE} -# Used when building a release. -# -RELEASEMACHINE?= ${MACHINE} - -# -# NEED_OWN_INSTALL_TARGET is set to "no" by pkgsrc/mk/bsd.pkg.mk to -# ensure that things defined by (default targets, -# INSTALL_FILE, etc.) are not conflicting with bsd.pkg.mk. -# -NEED_OWN_INSTALL_TARGET?= yes - -# -# This lists the platforms which do not have working in-tree toolchains. For -# the in-tree gcc toolchain, this list is empty. -# -# If some future port is not supported by the in-tree toolchain, this should -# be set to "yes" for that port only. -# -.if ${MACHINE} == "playstation2" -TOOLCHAIN_MISSING?= yes -.endif - -TOOLCHAIN_MISSING?= no - -.if ${MACHINE_CPU} == "aarch64" && !defined(EXTERNAL_TOOLCHAIN) && ${MKLLVM:Uyes} != "no" -MKLLVM?= yes -HAVE_LLVM?= yes -MKGCC?= no -.endif - -# -# GCC Using platforms. -# -.if ${MKGCC:Uyes} != "no" - -.if ${MACHINE} == "playstation2" || ${MACHINE_CPU} == "aarch64" -HAVE_GCC?= 0 -.else -# Otherwise, default to GCC4.8 -HAVE_GCC?= 48 -.endif - -# -# Platforms that can't run a modern GCC natively -.if ${MACHINE_ARCH} == "m68000" -MKGCCCMDS?= no -.endif - -# -# We import the old gcc as "gcc.old" when upgrading. EXTERNAL_GCC_SUBDIR is -# set to the relevant subdirectory in src/external/gpl3 for his HAVE_GCC. -# -.if ${HAVE_GCC} == 5 -EXTERNAL_GCC_SUBDIR= gcc -.elif ${HAVE_GCC} == 48 -EXTERNAL_GCC_SUBDIR= gcc.old -.else -EXTERNAL_GCC_SUBDIR= /does/not/exist -.endif -.else -MKGCCCMDS?= no -.endif - -.if !empty(MACHINE_ARCH:Mearm*) -_LIBC_COMPILER_RT.${MACHINE_ARCH}= yes -.endif - -_LIBC_COMPILER_RT.aarch64= yes -_LIBC_COMPILER_RT.i386= yes -_LIBC_COMPILER_RT.powerpc= yes -_LIBC_COMPILER_RT.powerpc64= yes -_LIBC_COMPILER_RT.x86_64= yes - -.if ${HAVE_LLVM:Uno} == "yes" && ${_LIBC_COMPILER_RT.${MACHINE_ARCH}:Uno} == "yes" -HAVE_LIBGCC?= no -.else -HAVE_LIBGCC?= yes -.endif - - -# ia64 is not support -.if ${HAVE_LLVM:Uno} == "yes" || !empty(MACHINE_ARCH:Mearm*) -HAVE_LIBGCC_EH?= no -.else -HAVE_LIBGCC_EH?= yes -.endif - -HAVE_GDB?= 79 - -.if (${MACHINE_ARCH} == "alpha") || \ - (${MACHINE_ARCH} == "hppa") || \ - (${MACHINE_ARCH} == "ia64") || \ - (${MACHINE_CPU} == "mips") -HAVE_SSP?= no -.else -HAVE_SSP?= yes -.if ${USE_FORT:Uno} != "no" -USE_SSP?= yes -.endif -.endif - -.if empty(.MAKEFLAGS:tW:M*-V .OBJDIR*) -.if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR) -PRINTOBJDIR= ${MAKE} -r -V .OBJDIR -f /dev/null xxx -.else -PRINTOBJDIR= ${MAKE} -V .OBJDIR -.endif -.else -PRINTOBJDIR= echo /error/bsd.own.mk/PRINTOBJDIR # avoid infinite recursion -.endif - -# -# Determine if running in the NetBSD source tree by checking for the -# existence of build.sh and tools/ in the current or a parent directory, -# and setting _SRC_TOP_ to the result. -# -.if !defined(_SRC_TOP_) # { -_SRC_TOP_!= cd "${.CURDIR}"; while :; do \ - here=`pwd`; \ - [ -f build.sh ] && [ -d tools ] && { echo $$here; break; }; \ - case $$here in /) echo ""; break;; esac; \ - cd ..; done - -.MAKEOVERRIDES+= _SRC_TOP_ - -.endif # } - -# -# If _SRC_TOP_ != "", we're within the NetBSD source tree. -# * Set defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_. -# * Define _NETBSD_VERSION_DEPENDS. Targets that depend on the -# NetBSD version, or on variables defined at build time, can -# declare a dependency on ${_NETBSD_VERSION_DEPENDS}. -# -.if (${_SRC_TOP_} != "") # { - -NETBSDSRCDIR?= ${_SRC_TOP_} - -.if !defined(_SRC_TOP_OBJ_) -_SRC_TOP_OBJ_!= cd "${_SRC_TOP_}" && ${PRINTOBJDIR} -.MAKEOVERRIDES+= _SRC_TOP_OBJ_ -.endif - -_NETBSD_VERSION_DEPENDS= ${_SRC_TOP_OBJ_}/params -_NETBSD_VERSION_DEPENDS+= ${NETBSDSRCDIR}/sys/sys/param.h -_NETBSD_VERSION_DEPENDS+= ${NETBSDSRCDIR}/sys/conf/newvers.sh -_NETBSD_VERSION_DEPENDS+= ${NETBSDSRCDIR}/sys/conf/osrelease.sh -${_SRC_TOP_OBJ_}/params: .NOTMAIN .OPTIONAL # created by top level "make build" - -.endif # _SRC_TOP_ != "" # } - - -.if (${_SRC_TOP_} != "") && \ - (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) -USETOOLS?= yes -.endif -USETOOLS?= no - - -.if ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mips64" || \ - ${MACHINE_ARCH} == "sh3" -.BEGIN: - @echo "Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el" - @false -.elif defined(REQUIRETOOLS) && \ - (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) && \ - ${USETOOLS} == "no" -.BEGIN: - @echo "USETOOLS=no, but this component requires a version-specific host toolchain" - @false -.endif - -# -# Host platform information; may be overridden -# -.include - -.if ${USETOOLS} == "yes" # { - -# -# Provide a default for TOOLDIR. -# -.if !defined(TOOLDIR) -TOOLDIR:= ${_SRC_TOP_OBJ_}/tooldir.${HOST_OSTYPE} -.MAKEOVERRIDES+= TOOLDIR -.endif - -# -# This is the prefix used for the NetBSD-sourced tools. -# -_TOOL_PREFIX?= nb - -# -# If an external toolchain base is specified, use it. -# -.if defined(EXTERNAL_TOOLCHAIN) # { -AR= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ar -AS= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-as -LD= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ld -NM= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-nm -OBJCOPY= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objcopy -OBJDUMP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objdump -RANLIB= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ranlib -READELF= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-readelf -SIZE= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-size -STRINGS= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strings -STRIP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strip - -TOOL_CC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc -TOOL_CPP.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-cpp -TOOL_CXX.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-c++ -TOOL_FC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-g77 -TOOL_OBJC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc - -TOOL_CC.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang -TOOL_CPP.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp -TOOL_CXX.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang++ -TOOL_OBJC.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang -TOOL_OPT.clang= ${EXTERNAL_TOOLCHAIN}/bin/opt -TOOL_LLC.clang= ${EXTERNAL_TOOLCHAIN}/bin/llc -.else # } { -# Define default locations for common tools. -.if ${USETOOLS_BINUTILS:Uyes} == "yes" # { -AR= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ar -AS= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-as -LD= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ld -NM= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-nm -OBJCOPY= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objcopy -OBJDUMP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objdump -RANLIB= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ranlib -READELF= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-readelf -SIZE= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-size -STRINGS= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strings -STRIP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strip - -# GCC supports C, C++, Fortran and Objective C -TOOL_CC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc -TOOL_CPP.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-cpp -TOOL_CXX.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-c++ -TOOL_FC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-g77 -TOOL_OBJC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc -.endif # } - -# Clang supports C, C++ and Objective C -TOOL_CC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang -TOOL_CPP.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp -TOOL_CXX.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang++ -TOOL_OBJC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang -TOOL_OPT.clang= ${TOOLDIR}/bin/opt -TOOL_LLC.clang= ${TOOLDIR}/bin/llc - -# PCC supports C and Fortran -TOOL_CC.pcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc -TOOL_CPP.pcc= ${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-cpp -TOOL_CXX.pcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-p++ - -# -# Make sure DESTDIR is set, so that builds with these tools always -# get appropriate -nostdinc, -nostdlib, etc. handling. The default is -# , meaning start from /, the root directory. -# -DESTDIR?= - -.if !defined(HOSTPROG) && !defined(HOSTLIB) -. if ${DESTDIR} != "" -CPPFLAGS+= --sysroot=${DESTDIR} -LDFLAGS+= --sysroot=${DESTDIR} -. else -CPPFLAGS+= --sysroot=/ -LDFLAGS+= --sysroot=/ -. endif -.endif -.endif # EXTERNAL_TOOLCHAIN # } - -DBSYM= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-dbsym -ELF2AOUT= ${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout -ELF2ECOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff -INSTALL= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install -LEX= ${TOOLDIR}/bin/${_TOOL_PREFIX}lex -LINT= CC=${CC:Q} ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-lint -LORDER= NM=${NM:Q} MKTEMP=${TOOL_MKTEMP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}lorder -MKDEP= CC=${CC:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep -MKDEPCXX= CC=${CXX:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep -PAXCTL= ${TOOLDIR}/bin/${_TOOL_PREFIX}paxctl -TSORT= ${TOOLDIR}/bin/${_TOOL_PREFIX}tsort -q -YACC= ${TOOLDIR}/bin/${_TOOL_PREFIX}yacc - -TOOL_AMIGAAOUT2BB= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-aout2bb -TOOL_AMIGAELF2BB= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-elf2bb -TOOL_AMIGATXLT= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-txlt -TOOL_ASN1_COMPILE= ${TOOLDIR}/bin/${_TOOL_PREFIX}asn1_compile -TOOL_AWK= ${TOOLDIR}/bin/${_TOOL_PREFIX}awk -TOOL_CAP_MKDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}cap_mkdb -TOOL_CAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}cat -TOOL_CKSUM= ${TOOLDIR}/bin/${_TOOL_PREFIX}cksum -TOOL_CLANG_TBLGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}clang-tblgen -TOOL_COMPILE_ET= ${TOOLDIR}/bin/${_TOOL_PREFIX}compile_et -TOOL_CONFIG= ${TOOLDIR}/bin/${_TOOL_PREFIX}config -TOOL_CRUNCHGEN= MAKE=${.MAKE:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}crunchgen -TOOL_CTAGS= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctags -TOOL_CTFCONVERT= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctfconvert -TOOL_CTFMERGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctfmerge -TOOL_DB= ${TOOLDIR}/bin/${_TOOL_PREFIX}db -TOOL_DISKLABEL= ${TOOLDIR}/bin/nbdisklabel -TOOL_EQN= ${TOOLDIR}/bin/${_TOOL_PREFIX}eqn -TOOL_FDISK= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk -TOOL_FGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}fgen -TOOL_GENASSYM= ${TOOLDIR}/bin/${_TOOL_PREFIX}genassym -TOOL_GENCAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}gencat -TOOL_GMAKE= ${TOOLDIR}/bin/${_TOOL_PREFIX}gmake -TOOL_GREP= ${TOOLDIR}/bin/${_TOOL_PREFIX}grep -TOOL_GROFF= PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}groff -TOOL_HEXDUMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}hexdump -TOOL_HP300MKBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}hp300-mkboot -TOOL_HPPAMKBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}hppa-mkboot -TOOL_INDXBIB= ${TOOLDIR}/bin/${_TOOL_PREFIX}indxbib -TOOL_INSTALLBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}installboot -TOOL_INSTALL_INFO= ${TOOLDIR}/bin/${_TOOL_PREFIX}install-info -TOOL_JOIN= ${TOOLDIR}/bin/${_TOOL_PREFIX}join -TOOL_LLVM_TBLGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}llvm-tblgen -TOOL_M4= ${TOOLDIR}/bin/${_TOOL_PREFIX}m4 -TOOL_MACPPCFIXCOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}macppc-fixcoff -TOOL_MAKEFS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makefs -TOOL_MAKEINFO= ${TOOLDIR}/bin/${_TOOL_PREFIX}makeinfo -TOOL_MAKEKEYS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makekeys -TOOL_MAKESTRS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makestrs -TOOL_MAKEWHATIS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makewhatis -TOOL_MANDOC_ASCII= ${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tascii -TOOL_MANDOC_HTML= ${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Thtml -TOOL_MANDOC_LINT= ${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tlint -TOOL_MDSETIMAGE= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-mdsetimage -TOOL_MENUC= MENUDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}menuc -TOOL_M68KELF2AOUT= ${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout -TOOL_MIPSELF2ECOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff -TOOL_MKCSMAPPER= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkcsmapper -TOOL_MKESDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkesdb -TOOL_MKFSMFS= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkfs.mfs -TOOL_MKLOCALE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mklocale -TOOL_MKMAGIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}file -TOOL_MKNOD= ${TOOLDIR}/bin/${_TOOL_PREFIX}mknod -TOOL_MKTEMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}mktemp -TOOL_MKUBOOTIMAGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkubootimage -TOOL_ELFTOSB= ${TOOLDIR}/bin/${_TOOL_PREFIX}elftosb -TOOL_MSGC= MSGDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}msgc -TOOL_MTREE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mtree -TOOL_NBPERF= ${TOOLDIR}/bin/${_TOOL_PREFIX}perf -TOOL_NCDCS= ${TOOLDIR}/bin/${_TOOL_PREFIX}ibmnws-ncdcs -TOOL_PAX= ${TOOLDIR}/bin/${_TOOL_PREFIX}pax -TOOL_PIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}pic -TOOL_PIGZ= ${TOOLDIR}/bin/${_TOOL_PREFIX}pigz -TOOL_PKG_CREATE= ${TOOLDIR}/bin/${_TOOL_PREFIX}pkg_create -TOOL_POWERPCMKBOOTIMAGE=${TOOLDIR}/bin/${_TOOL_PREFIX}powerpc-mkbootimage -TOOL_PWD_MKDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}pwd_mkdb -TOOL_REFER= ${TOOLDIR}/bin/${_TOOL_PREFIX}refer -TOOL_ROFF_ASCII= PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}nroff -TOOL_ROFF_DOCASCII= ${TOOL_GROFF} -Tascii -TOOL_ROFF_DOCHTML= ${TOOL_GROFF} -Thtml -TOOL_ROFF_DVI= ${TOOL_GROFF} -Tdvi -TOOL_ROFF_HTML= ${TOOL_GROFF} -Tlatin1 -mdoc2html -TOOL_ROFF_PS= ${TOOL_GROFF} -Tps -TOOL_ROFF_RAW= ${TOOL_GROFF} -Z -TOOL_RPCGEN= RPCGEN_CPP=${CPP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}rpcgen -TOOL_SED= ${TOOLDIR}/bin/${_TOOL_PREFIX}sed -TOOL_SLC= ${TOOLDIR}/bin/${_TOOL_PREFIX}slc -TOOL_SOELIM= ${TOOLDIR}/bin/${_TOOL_PREFIX}soelim -TOOL_SPARKCRC= ${TOOLDIR}/bin/${_TOOL_PREFIX}sparkcrc -TOOL_STAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}stat -TOOL_STRFILE= ${TOOLDIR}/bin/${_TOOL_PREFIX}strfile -TOOL_SUNLABEL= ${TOOLDIR}/bin/${_TOOL_PREFIX}sunlabel -TOOL_TBL= ${TOOLDIR}/bin/${_TOOL_PREFIX}tbl -TOOL_TIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}tic -TOOL_TOPROTO= ${TOOLDIR}/bin/${_TOOL_PREFIX}toproto -TOOL_UUDECODE= ${TOOLDIR}/bin/${_TOOL_PREFIX}uudecode -TOOL_VGRIND= ${TOOLDIR}/bin/${_TOOL_PREFIX}vgrind -f -TOOL_VFONTEDPR= ${TOOLDIR}/libexec/${_TOOL_PREFIX}vfontedpr -TOOL_ZIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}zic - -.else # USETOOLS != yes # } { - -# Clang supports C, C++ and Objective C -TOOL_CC.clang= clang -.if defined(__MINIX) -TOOL_CPP.clang= clang -E -.else -TOOL_CPP.clang= clang-cpp -.endif # defined(__MINIX) -TOOL_CXX.clang= clang++ -TOOL_OBJC.clang= clang -TOOL_OPT.clang= opt -TOOL_LLC.clang= llc - -# GCC supports C, C++, Fortran and Objective C -TOOL_CC.gcc= gcc -TOOL_CPP.gcc= cpp -TOOL_CXX.gcc= c++ -TOOL_FC.gcc= g77 -TOOL_OBJC.gcc= gcc - -# PCC supports C and Fortran -TOOL_CC.pcc= pcc -TOOL_CPP.pcc= /usr/libexec/pcpp -TOOL_CXX.pcc= p++ - -TOOL_AMIGAAOUT2BB= amiga-aout2bb -TOOL_AMIGAELF2BB= amiga-elf2bb -TOOL_AMIGATXLT= amiga-txlt -TOOL_ASN1_COMPILE= asn1_compile -TOOL_AWK= awk -TOOL_CAP_MKDB= cap_mkdb -TOOL_CAT= cat -TOOL_CKSUM= cksum -.if defined(__MINIX) -# LSC: A full path has to be provided, as this is also used as a make -# target. -. if exists(/usr/pkg/bin/clang-tblgen) -TOOL_CLANG_TBLGEN= /usr/pkg/bin/clang-tblgen -. else -TOOL_CLANG_TBLGEN= /usr/bin/clang-tblgen -. endif # exists(/usr/pkg/bin/clang-tblgen) -.else -TOOL_CLANG_TBLGEN= clang-tblgen -.endif # defined(__MINIX) -TOOL_COMPILE_ET= compile_et -TOOL_CONFIG= config -TOOL_CRUNCHGEN= crunchgen -TOOL_CTAGS= ctags -TOOL_CTFCONVERT= ctfconvert -TOOL_CTFMERGE= ctfmerge -TOOL_DB= db -TOOL_DISKLABEL= disklabel -TOOL_EQN= eqn -TOOL_FDISK= fdisk -TOOL_FGEN= fgen -TOOL_GENASSYM= genassym -TOOL_GENCAT= gencat -TOOL_GMAKE= gmake -TOOL_GREP= grep -TOOL_GROFF= groff -TOOL_HEXDUMP= hexdump -TOOL_HP300MKBOOT= hp300-mkboot -TOOL_HPPAMKBOOT= hppa-mkboot -TOOL_INDXBIB= indxbib -TOOL_INSTALLBOOT= installboot -TOOL_INSTALL_INFO= install-info -TOOL_JOIN= join -.if defined(__MINIX) -# LSC: A full path has to be provided, as this is also used as a make -# target. -. if exists(/usr/pkg/bin/llvm-tblgen) -TOOL_LLVM_TBLGEN= /usr/pkg/bin/llvm-tblgen -. else -TOOL_LLVM_TBLGEN= /usr/bin/llvm-tblgen -. endif # exists(/usr/pkg/bin/llvm-tblgen) -.else -TOOL_LLVM_TBLGEN= llvm-tblgen -.endif # defined(__MINIX) -TOOL_M4= m4 -TOOL_MACPPCFIXCOFF= macppc-fixcoff -TOOL_MAKEFS= makefs -TOOL_MAKEINFO= makeinfo -.if defined(__MINIX) -# LSC: A full path has to be provided, as this is also used as a make -# target. -TOOL_MAKEKEYS= /usr/X11R7/bin/makekeys -.else -TOOL_MAKEKEYS= makekeys -.endif # defined(__MINIX) -.if defined(__MINIX) -# LSC: A full path has to be provided, as this is also used as a make -# target. -TOOL_MAKESTRS= /usr/X11R7/bin/makestrs -.else -TOOL_MAKESTRS= makestrs -.endif # defined(__MINIX) -TOOL_MAKEWHATIS= /usr/libexec/makewhatis -TOOL_MANDOC_ASCII= mandoc -Tascii -TOOL_MANDOC_HTML= mandoc -Thtml -TOOL_MANDOC_LINT= mandoc -Tlint -TOOL_MDSETIMAGE= mdsetimage -TOOL_MENUC= menuc -TOOL_M68KELF2AOUT= m68k-elf2aout -TOOL_MIPSELF2ECOFF= mips-elf2ecoff -TOOL_MKCSMAPPER= mkcsmapper -TOOL_MKESDB= mkesdb -TOOL_MKFSMFS= mkfs.mfs -TOOL_MKLOCALE= mklocale -TOOL_MKMAGIC= file -TOOL_MKNOD= mknod -TOOL_MKTEMP= mktemp -TOOL_MKUBOOTIMAGE= mkubootimage -TOOL_ELFTOSB= elftosb -TOOL_MSGC= msgc -TOOL_MTREE= mtree -TOOL_NBPERF= nbperf -TOOL_NCDCS= ncdcs -TOOL_PAX= pax -TOOL_PIC= pic -TOOL_PIGZ= pigz -TOOL_PKG_CREATE= pkg_create -TOOL_POWERPCMKBOOTIMAGE= powerpc-mkbootimage -TOOL_PWD_MKDB= pwd_mkdb -TOOL_REFER= refer -TOOL_ROFF_ASCII= nroff -TOOL_ROFF_DOCASCII= ${TOOL_GROFF} -Tascii -TOOL_ROFF_DOCHTML= ${TOOL_GROFF} -Thtml -TOOL_ROFF_DVI= ${TOOL_GROFF} -Tdvi -TOOL_ROFF_HTML= ${TOOL_GROFF} -Tlatin1 -mdoc2html -TOOL_ROFF_PS= ${TOOL_GROFF} -Tps -TOOL_ROFF_RAW= ${TOOL_GROFF} -Z -TOOL_RPCGEN= rpcgen -TOOL_SED= sed -TOOL_SOELIM= soelim -TOOL_SPARKCRC= sparkcrc -TOOL_STAT= stat -.if defined(__MINIX) -TOOL_STRFILE= /usr/games/strfile -.else -TOOL_STRFILE= strfile -.endif # defined(__MINIX) -TOOL_SUNLABEL= sunlabel -TOOL_TBL= tbl -.if defined(__MINIX) -# LSC: There is a tic packaged, which has a completly different set of -# options, so make sure to use the base system one, always. -TOOL_TIC= /usr/bin/tic -.else -TOOL_TIC= tic -.endif # defined(__MINIX) -TOOL_TOPROTO= toproto -TOOL_UUDECODE= uudecode -TOOL_VGRIND= vgrind -f -TOOL_VFONTEDPR= /usr/libexec/vfontedpr -TOOL_ZIC= zic - -.endif # USETOOLS != yes # } - -# Fallback to ensure that all variables are defined to something -TOOL_CC.false= false -TOOL_CPP.false= false -TOOL_CXX.false= false -TOOL_FC.false= false -TOOL_OBJC.false= false -TOOL_OPT.false= false -TOOL_LLC.false= false - -AVAILABLE_COMPILER?= ${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} ${EXTERNAL_TOOLCHAIN:Dgcc} false - -.for _t in CC CPP CXX FC OBJC OPT LLC -ACTIVE_${_t}= ${AVAILABLE_COMPILER:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@:[1]} -SUPPORTED_${_t}=${AVAILABLE_COMPILER:Nfalse:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@} -.endfor -# make bugs prevent moving this into the .for loop -CC= ${TOOL_CC.${ACTIVE_CC}} -CPP= ${TOOL_CPP.${ACTIVE_CPP}} -CXX= ${TOOL_CXX.${ACTIVE_CXX}} -FC= ${TOOL_FC.${ACTIVE_FC}} -OBJC= ${TOOL_OBJC.${ACTIVE_OBJC}} -OPT= ${TOOL_OPT.${ACTIVE_OPT}} -LLC= ${TOOL_LLC.${ACTIVE_LLC}} - -# Override with tools versions if needed -.if ${MKCTF:Uno} != "no" && !defined(NOCTF) -CTFCONVERT= ${TOOL_CTFCONVERT} -CTFMERGE= ${TOOL_CTFMERGE} -.endif - -# For each ${MACHINE_CPU}, list the ports that use it. -MACHINES.aarch64= evbarm64 -MACHINES.alpha= alpha -MACHINES.arm= acorn26 acorn32 cats epoc32 evbarm hpcarm \ - iyonix netwinder shark zaurus -MACHINES.coldfire= evbcf -MACHINES.i386= i386 -MACHINES.ia64= ia64 -MACHINES.hppa= hppa -MACHINES.m68000= sun2 -MACHINES.m68k= amiga atari cesfic hp300 luna68k mac68k \ - news68k next68k sun3 x68k -MACHINES.mips= arc cobalt algor cobalt emips evbmips ews4800mips \ - hpcmips mipsco newsmips pmax sbmips sgimips -MACHINES.or1k= or1k -MACHINES.powerpc= amigappc bebox evbppc ibmnws macppc mvmeppc \ - ofppc prep rs6000 sandpoint -MACHINES.riscv= riscv -MACHINES.sh3= dreamcast evbsh3 hpcsh landisk mmeye -MACHINES.sparc= sparc sparc64 -MACHINES.sparc64= sparc64 -MACHINES.vax= vax -MACHINES.x86_64= amd64 - -# for crunchide & ldd, define the OBJECT_FMTS used by a MACHINE_ARCH -# -OBJECT_FMTS= -.if ${MACHINE_ARCH} != "alpha" -OBJECT_FMTS+= elf32 -.endif -.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH:M*64*} != "" -OBJECT_FMTS+= elf64 -.endif - -# OBJCOPY flags to create a.out binaries for old firmware -# shared among src/distrib and ${MACHINE}/conf/Makefile.${MACHINE}.inc -.if ${MACHINE_CPU} == "arm" -OBJCOPY_ELF2AOUT_FLAGS?= \ - -O a.out-arm-netbsd \ - -R .ident \ - -R .ARM.attributes \ - -R .ARM.exidx \ - -R .ARM.extab \ - -R .arm.atpcs \ - -R .comment \ - -R .debug_abbrev \ - -R .debug_aranges \ - -R .debug_info \ - -R .debug_line \ - -R .debug_frame \ - -R .debug_loc \ - -R .debug_pubnames \ - -R .debug_pubtypes \ - -R .debug_ranges \ - -R .debug_str \ - -R .eh_frame \ - -R .note.netbsd.ident -.endif - -# -# Targets to check if DESTDIR or RELEASEDIR is provided -# -.if !target(check_DESTDIR) -check_DESTDIR: .PHONY .NOTMAIN -.if !defined(DESTDIR) - @echo "setenv DESTDIR before doing that!" - @false -.else - @true -.endif -.endif - -.if !target(check_RELEASEDIR) -check_RELEASEDIR: .PHONY .NOTMAIN -.if !defined(RELEASEDIR) - @echo "setenv RELEASEDIR before doing that!" - @false -.else - @true -.endif -.endif - -# -# Build a dynamically linked /bin and /sbin, with the necessary shared -# libraries moved from /usr/lib to /lib and the shared linker moved -# from /usr/libexec to /lib -# -# Note that if the BINDIR is not /bin or /sbin, then we always use the -# non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin -# and /sbin). See . -# -MKDYNAMICROOT?= 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 -NETBSDSRCDIR?= ${BSDSRCDIR} - -BINGRP?= wheel -BINOWN?= root -BINMODE?= 555 -NONBINMODE?= 444 - -# These are here mainly because we don't want suid root in case -# a Makefile defines BINMODE. -RUMPBINGRP?= wheel -RUMPBINOWN?= root -RUMPBINMODE?= 555 -RUMPNONBINMODE?=444 - -MANDIR?= /usr/share/man -MANGRP?= wheel -MANOWN?= root -MANMODE?= ${NONBINMODE} -MANINSTALL?= ${_MANINSTALL} - -INFODIR?= /usr/share/info -INFOGRP?= wheel -INFOOWN?= root -INFOMODE?= ${NONBINMODE} - -LIBDIR?= /usr/lib - -LINTLIBDIR?= /usr/libdata/lint -LIBGRP?= ${BINGRP} -LIBOWN?= ${BINOWN} -LIBMODE?= ${NONBINMODE} - -DOCDIR?= /usr/share/doc -DOCGRP?= wheel -DOCOWN?= root -DOCMODE?= ${NONBINMODE} - -NLSDIR?= /usr/share/nls -NLSGRP?= wheel -NLSOWN?= root -NLSMODE?= ${NONBINMODE} - -KMODULEGRP?= wheel -KMODULEOWN?= root -KMODULEMODE?= ${NONBINMODE} - -LOCALEDIR?= /usr/share/locale -LOCALEGRP?= wheel -LOCALEOWN?= root -LOCALEMODE?= ${NONBINMODE} - -FIRMWAREDIR?= /libdata/firmware -FIRMWAREGRP?= wheel -FIRMWAREOWN?= root -FIRMWAREMODE?= ${NONBINMODE} - -DEBUGDIR?= /usr/libdata/debug -DEBUGGRP?= wheel -DEBUGOWN?= root -DEBUGMODE?= ${NONBINMODE} - -# -# 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". -# -# All platforms are ELF. -# -OBJECT_FMT= ELF - -# -# If this platform's toolchain is missing, we obviously cannot build it. -# -.if ${TOOLCHAIN_MISSING} != "no" -MKBINUTILS:= no -MKGDB:= no -MKGCC:= no -.endif - -# -# If we are using an external toolchain, we can still build the target's -# binutils, but we cannot build GCC's support libraries, since those are -# tightly-coupled to the version of GCC being used. -# -.if defined(EXTERNAL_TOOLCHAIN) -MKGCC:= no -.endif - -# No GDB support for aarch64 -MKGDB.aarch64= no -MKGDB.or1k= no -MKGDB.riscv32= no -MKGDB.riscv64= no - -# No kernel modules for or1k (yet) -MKKMOD.or1k= no -MKKMOD.riscv32= no -MKKMOD.riscv64= no - -# No profiling for or1k (yet) -MKPROFILE.or1k= no -MKPROFILE.riscv32=no -MKPROFILE.riscv64=no - -# -# The m68000 port is incomplete. -# -.if ${MACHINE_ARCH} == "m68000" -NOPIC= # defined -MKISCSI= no -# XXX GCC 4 outputs mcount() calling sequences that try to load values -# from over 64KB away and this fails to assemble. -.if defined(HAVE_GCC) -NOPROFILE= # defined -.endif -.endif - -# -# The ia64 port is incomplete. -# -MKLINT.ia64= no -MKGDB.ia64= no - -# -# On the MIPS, all libs are compiled with ABIcalls (and are thus PIC), -# not just shared libraries, so don't build the _pic version. -# -.if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ - ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb" -MKPICLIB:= no -.endif - -# PowerPC64 and AArch64 ABI's are PIC -MKPICLIB.powerpc64= no -#MKPICLIB.aarch64= no - -# -# On VAX using ELF, all objects are PIC, not just shared libraries, -# so don't build the _pic version. -# -MKPICLIB.vax= no - -# -# Location of the file that contains the major and minor numbers of the -# version of a shared library. If this file exists a shared library -# will be built by . -# -SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version - -# -# GNU sources and packages sometimes see architecture names differently. -# -GNU_ARCH.aarch64eb=aarch64_be -GNU_ARCH.coldfire=m5407 -GNU_ARCH.earm=arm -GNU_ARCH.earmhf=arm -GNU_ARCH.earmeb=armeb -GNU_ARCH.earmhfeb=armeb -GNU_ARCH.earmv4=armv4 -GNU_ARCH.earmv4eb=armv4eb -GNU_ARCH.earmv5=arm -GNU_ARCH.earmv5eb=armeb -GNU_ARCH.earmv6=armv6 -GNU_ARCH.earmv6hf=armv6 -GNU_ARCH.earmv6eb=armv6eb -GNU_ARCH.earmv6hfeb=armv6eb -GNU_ARCH.earmv7=armv7 -GNU_ARCH.earmv7hf=armv7 -GNU_ARCH.earmv7eb=armv7eb -GNU_ARCH.earmv7hfeb=armv7eb -GNU_ARCH.i386=i486 -GCC_CONFIG_ARCH.i386=i486 -GCC_CONFIG_TUNE.i386=nocona -GCC_CONFIG_TUNE.x86_64=nocona -GNU_ARCH.m68000=m68010 -GNU_ARCH.sh3eb=sh -GNU_ARCH.sh3el=shle -GNU_ARCH.mips64eb=mips64 - -.if defined(__MINIX) -# MINIX/arm default -GCC_CONFIG_ARCH.earm=armv7-a - -# MINIX/intel default -GNU_ARCH.i386=i586 -GCC_CONFIG_ARCH.i386=i586 - -.endif # defined(__MINIX) - -MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}} - -# -# In order to identify NetBSD to GNU packages, we sometimes need -# an "elf" tag for historically a.out platforms. -# -.if (!empty(MACHINE_ARCH:Mearm*)) -MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf-${MACHINE_ARCH:C/eb//:C/v[4-7]//:S/earm/eabi/} -.elif (${MACHINE_GNU_ARCH} == "arm" || \ - ${MACHINE_GNU_ARCH} == "armeb" || \ - ${MACHINE_ARCH} == "i386" || \ - ${MACHINE_CPU} == "m68k" || \ - ${MACHINE_GNU_ARCH} == "sh" || \ - ${MACHINE_GNU_ARCH} == "shle" || \ - ${MACHINE_ARCH} == "sparc" || \ - ${MACHINE_ARCH} == "vax") -MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf -.else -MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd -.endif - -.if defined(__MINIX) -# We have a simpler toolchain naming scheme -MACHINE_GNU_PLATFORM:=${MACHINE_GNU_ARCH}-elf32-minix - -# We need to check for HAVE_GOLD after LD has been set -. if ${_HAVE_GOLD:U} == "" - _HAVE_GOLD!= (exec 2>&1; ${LD} --version || echo "") - _GOLD_MATCH:=${_HAVE_GOLD:Mgold} - _HAVE_GOLD:= ${_HAVE_GOLD:M[0-9]\.[0-9][0-9]} - -. if ${_GOLD_MATCH} != "" && ${_HAVE_GOLD} != "" - HAVE_GOLD?= ${_HAVE_GOLD} - -# Without -Wl,--no-ctors-in-init-array, gold moves the constructors out of -# .ctors into .init_array, which is bad on intel. - LDFLAGS+= -Wl,--no-ctors-in-init-array -. else - USE_BITCODE:=no -. endif -. endif # ${_HAVE_GOLD:U} == "" -.endif # defined(__MINIX) - -.if !empty(MACHINE_ARCH:M*arm*) -# Flags to pass to CC for using the old APCS ABI on ARM for compat or stand. -ARM_APCS_FLAGS= -mabi=apcs-gnu -mfloat-abi=soft -ARM_APCS_FLAGS+=${${ACTIVE_CC} == "gcc":? -marm :} -ARM_APCS_FLAGS+=${${ACTIVE_CC} == "clang":? -target ${MACHINE_GNU_ARCH}--netbsdelf -B ${TOOLDIR}/${MACHINE_GNU_PLATFORM}/bin :} -.endif - -GENASSYM_CPPFLAGS+= ${${ACTIVE_CC} == "clang":? -no-integrated-as :} - -TARGETS+= all clean cleandir depend dependall includes \ - install lint obj regress tags html analyze -PHONY_NOTMAIN = all clean cleandir depend dependall distclean includes \ - install lint obj regress beforedepend afterdepend \ - beforeinstall afterinstall realinstall realdepend realall \ - html subdir-all subdir-install subdir-depend analyze -.PHONY: ${PHONY_NOTMAIN} -.NOTMAIN: ${PHONY_NOTMAIN} - -.if ${NEED_OWN_INSTALL_TARGET} != "no" -.if !target(install) -install: beforeinstall .WAIT subdir-install realinstall .WAIT afterinstall -beforeinstall: -subdir-install: -realinstall: -afterinstall: -.endif -all: realall subdir-all -subdir-all: -realall: -depend: realdepend subdir-depend -subdir-depend: -realdepend: -distclean: cleandir -cleandir: clean - -dependall: .NOTMAIN realdepend .MAKE - @cd "${.CURDIR}"; ${MAKE} realall -.endif - -# -# Define MKxxx variables (which are either yes or no) for users -# to set in /etc/mk.conf and override in the make environment. -# These should be tested with `== "no"' or `!= "no"'. -# The NOxxx variables should only be set by Makefiles. -# -# Please keep etc/Makefile and share/man/man5/mk.conf.5 in sync -# with changes to the MK* variables here. -# - -# -# Supported NO* options (if defined, MK* will be forced to "no", -# regardless of user's mk.conf setting). -# -# Source makefiles should set NO*, and not MK*, and must do so before -# including bsd.own.mk. -# -.for var in \ - NOCRYPTO NODOC NOHTML NOINFO NOLINKLIB NOLINT NOMAN NONLS NOOBJ NOPIC \ - NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB -.if defined(${var}) -MK${var:S/^NO//}:= no -.endif -.endfor - -# -# Older-style variables that enabled behaviour when set. -# -.for var in MANZ UNPRIVED UPDATE -.if defined(${var}) -MK${var}:= yes -.endif -.endfor - -# -# MK* options which have variable defaults. -# -.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64" \ - || ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" \ - || ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_CPU} == "aarch64" \ - || ${MACHINE_ARCH} == "riscv64" \ - || !empty(MACHINE_ARCH:Mearm*) -MKCOMPAT?= yes -.else -# Don't let this build where it really isn't supported. -MKCOMPAT:= no -MKCOMPATTESTS:= no -MKCOMPATX11:= no -.endif - -.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" \ - || ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" \ - || (${MACHINE} == "evbppc" && ${MACHINE_ARCH} == "powerpc") -MKCOMPATMODULES?= yes -.else -MKCOMPATMODULES:= no -.endif - -# -# Default mips64 to softfloat now. -# arm is always softfloat unless it isn't -# emips is always softfloat. -# coldfire is always softfloat -# or1k is always softfloat -# -.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" || \ - (${MACHINE_CPU} == "arm" && ${MACHINE_ARCH:M*hf*} == "") || \ - ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "or1k" || \ - ${MACHINE} == "emips" -MKSOFTFLOAT?= yes -.endif - -.if ${MACHINE} == "emips" -SOFTFLOAT_BITS= 32 -.endif - -.if ${MACHINE_ARCH} == "i386" || \ - ${MACHINE_ARCH} == "x86_64" || \ - ${MACHINE_ARCH} == "sparc" -MKSLJIT?= yes -.else -MKSLJIT?= no -.endif - -# -# MK* backward compatibility. -# -.if defined(MKBFD) -MKBINUTILS?= ${MKBFD} -.endif - -# -# We want to build zfs only for amd64 by default for now. -# -.if ${MACHINE} == "amd64" -MKZFS?= yes -.endif - -# -# MK* options which default to "yes". -# -_MKVARS.yes= \ - MKATF \ - MKBINUTILS \ - MKCRYPTO MKCOMPLEX MKCVS MKCXX \ - MKDOC \ - MKGCC MKGDB MKGROFF \ - MKHESIOD MKHTML \ - MKIEEEFP MKINET6 MKINFO MKIPFILTER MKISCSI \ - MKKERBEROS \ - MKKMOD \ - MKLDAP MKLIBSTDCXX MKLINKLIB MKLVM \ - MKMAN MKMANDOC \ - MKMDNS \ - MKMAKEMANDB \ - MKNLS \ - MKNPF \ - MKOBJ \ - MKPAM MKPERFUSE \ - MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \ - MKRUMP \ - MKSHARE MKSKEY MKSTATICLIB \ - MKX11FONTS \ - MKYP - -#MINIX-specific vars -_MKVARS.yes+= \ - MKSYSDEBUG MKLIVEUPDATE MKLLVMCMDS -.if (${MACHINE_ARCH} == "i386") -_MKVARS.yes+= \ - MKWATCHDOG MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI -.endif - -.for var in ${_MKVARS.yes} -${var}?= ${${var}.${MACHINE_ARCH}:Uyes} -.endfor - -# -# MKGCCCMDS is only valid if we are building GCC so make it dependent on that. -# -_MKVARS.yes += MKGCCCMDS -MKGCCCMDS?= ${MKGCC} - -# -# Exceptions to the above: -# -.if ${MACHINE} == "acorn26" # page size is prohibitive -MKKMOD= no -.endif - -# -# MK* options which default to "no". Note that MKZFS has a different -# default for some platforms, see above. -# -_MKVARS.no= \ - MKBSDGREP MKBSDTAR \ - MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCRYPTO_RC5 MKCTF MKDEBUG \ - MKDEBUGLIB MKDTRACE MKEXTSRC MKGROFFHTMLDOC \ - MKKYUA MKLLD MKLLDB MKLINT \ - MKMANZ MKMCLINKER MKOBJDIRS \ - MKLIBCXX MKLLVM MKPCC \ - MKPIGZGZIP \ - MKREPRO \ - MKSOFTFLOAT MKSTRIPIDENT MKTPM \ - MKUNPRIVED MKUPDATE MKX11 MKX11MOTIF MKZFS - -#MINIX-specific vars -_MKVARS.no+= \ - MKIMAGEONLY MKSMALL MKBITCODE MKMAGIC MKPAE MKASR MKSRC -.if !empty(MACHINE_ARCH:Mearm*) -_MKVARS.no+= \ - MKWATCHDOG MKPAE MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI -.endif - -.for var in ${_MKVARS.no} -${var}?= ${${var}.${MACHINE_ARCH}:Uno} -.endfor - -# -# Which platforms build the xorg-server drivers (as opposed -# to just Xnest and Xvfb.) -# -.if ${MACHINE} == "alpha" || \ - ${MACHINE} == "amd64" || \ - ${MACHINE} == "bebox" || \ - ${MACHINE} == "cats" || \ - ${MACHINE} == "dreamcast" || \ - ${MACHINE} == "ews4800mips" || \ - ${MACHINE} == "evbarm" || \ - ${MACHINE} == "evbmips" || \ - ${MACHINE} == "hp300" || \ - ${MACHINE} == "hpcarm" || \ - ${MACHINE} == "hpcmips" || \ - ${MACHINE} == "hpcsh" || \ - ${MACHINE} == "i386" || \ - ${MACHINE} == "luna68k" || \ - ${MACHINE} == "mac68k" || \ - ${MACHINE} == "macppc" || \ - ${MACHINE} == "netwinder" || \ - ${MACHINE} == "newsmips" || \ - ${MACHINE} == "prep" || \ - ${MACHINE} == "ofppc" || \ - ${MACHINE} == "sgimips" || \ - ${MACHINE} == "shark" || \ - ${MACHINE} == "sparc" || \ - ${MACHINE} == "sparc64" || \ - ${MACHINE} == "vax" || \ - ${MACHINE} == "zaurus" -MKXORG_SERVER?=yes -.else -MKXORG_SERVER?=no -.endif - -# -# Force some options off if their dependencies are off. -# - -.if ${MKCXX} == "no" -MKATF:= no -MKGROFF:= no -MKKYUA:= no -.endif - -.if ${MKCRYPTO} == "no" -MKKERBEROS:= no -MKLDAP:= no -.endif - -.if ${MKMAN} == "no" -MKCATPAGES:= no -MKHTML:= no -.endif - -_MANINSTALL= maninstall -.if ${MKCATPAGES} != "no" -_MANINSTALL+= catinstall -.endif -.if ${MKHTML} != "no" -_MANINSTALL+= htmlinstall -.endif - -.if ${MKLINKLIB} == "no" -MKLINT:= no -MKPICINSTALL:= no -MKPROFILE:= no -.endif - -.if ${MKPIC} == "no" -MKPICLIB:= no -.endif - -.if ${MKOBJ} == "no" -MKOBJDIRS:= no -.endif - -.if ${MKSHARE} == "no" -MKCATPAGES:= no -MKDOC:= no -MKINFO:= no -MKHTML:= no -MKMAN:= no -MKNLS:= no -.endif - -# MINIX -.if ${MKSMALL} == "yes" -MKWATCHDOG:= no -MKACPI:= no -MKAPIC:= no -MKDEBUGREG:= no -MKSYSDEBUG:= no -MKLIVEUPDATE:= no -.endif - -# MINIX: MKASR implies MKMAGIC -.if ${MKASR} == "yes" -MKMAGIC:= yes -.endif - -# MINIX: MKMAGIC implies MKBITCODE -.if ${MKMAGIC} == "yes" -MKBITCODE:= yes -.endif - -.if !empty(MACHINE_ARCH:Mearm*) -_NEEDS_LIBCXX.${MACHINE_ARCH}= yes -.endif -_NEEDS_LIBCXX.i386= yes -_NEEDS_LIBCXX.powerpc= yes -_NEEDS_LIBCXX.powerpc64= yes -_NEEDS_LIBCXX.x86_64= yes -_NEEDS_LIBCXX.aarch64= yes - -.if ${MKLLVM} == "yes" && ${_NEEDS_LIBCXX.${MACHINE_ARCH}:Uno} == "yes" -MKLIBCXX:= yes -.endif - -# -# install(1) parameters. -# -COPY?= -c -.if ${MKUPDATE} == "no" -PRESERVE?= -.else -PRESERVE?= -p -.endif -RENAME?= -r -HRDLINK?= -l h -SYMLINK?= -l s - -METALOG?= ${DESTDIR}/METALOG -METALOG.add?= ${TOOL_CAT} -l >> ${METALOG} -.if (${_SRC_TOP_} != "") # only set INSTPRIV if inside ${NETBSDSRCDIR} -.if ${MKUNPRIVED} != "no" -INSTPRIV.unpriv=-U -M ${METALOG} -D ${DESTDIR} -h sha256 -.else -INSTPRIV.unpriv= -.endif -INSTPRIV?= ${INSTPRIV.unpriv} -N ${NETBSDSRCDIR}/etc -.endif -STRIPFLAG?= - -.if ${NEED_OWN_INSTALL_TARGET} != "no" -INSTALL_DIR?= ${INSTALL} ${INSTPRIV} -d -INSTALL_FILE?= ${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME} -INSTALL_LINK?= ${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME} -INSTALL_SYMLINK?= ${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME} -.endif - -# -# Set defaults for the USE_xxx variables. -# - -# -# USE_* options which default to "no" and will be forced to "no" if their -# corresponding MK* variable is set to "no". -# -.for var in USE_SKEY -.if (${${var:S/USE_/MK/}} == "no") -${var}:= no -.else -${var}?= no -.endif -.endfor - -# -# USE_* options which default to "yes" unless their corresponding MK* -# variable is set to "no". -# -.for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP -.if (${${var:S/USE_/MK/}} == "no") -${var}:= no -.else -${var}?= yes -.endif -.endfor - -#MINIX-specific vars -.for var in \ - USE_WATCHDOG USE_ACPI USE_PAE USE_APIC USE_DEBUGREG USE_SYSDEBUG \ - USE_LIVEUPDATE USE_PCI USE_BITCODE USE_MAGIC USE_ASR -.if (${${var:S/USE_/MK/}} == "no") -${var}:= no -.else -${var}?= yes -.endif -.endfor - -# -# USE_* options which default to "yes". -# -.for var in USE_JEMALLOC -${var}?= yes -.endfor - -# -# USE_* options which default to "no". -# -# For now, disable pigz as compressor by default -.for var in USE_PIGZGZIP USE_LIBTRE -${var}?= no -.endfor - -# -# TOOL_GZIP and friends. These might refer to TOOL_PIGZ or to the host gzip. -# -.if ${USE_PIGZGZIP} != "no" -TOOL_GZIP= ${TOOL_PIGZ} -GZIP_N_FLAG?= -nT -.else -TOOL_GZIP= gzip -GZIP_N_FLAG?= -n -.endif -TOOL_GZIP_N= ${TOOL_GZIP} ${GZIP_N_FLAG} - -# -# Where X11 sources are and where it is installed to. -# -.if !defined(X11SRCDIR) -.if exists(${NETBSDSRCDIR}/../xsrc) -X11SRCDIR!= cd "${NETBSDSRCDIR}/../xsrc" && pwd -.else -X11SRCDIR= /usr/xsrc -.endif -.endif # !defined(X11SRCDIR) - -X11SRCDIR.local?= ${X11SRCDIR}/local -X11ROOTDIR?= /usr/X11R7 -X11BINDIR?= ${X11ROOTDIR}/bin -X11ETCDIR?= /etc/X11 -X11FONTDIR?= ${X11ROOTDIR}/lib/X11/fonts -X11INCDIR?= ${X11ROOTDIR}/include -X11LIBDIR?= ${X11ROOTDIR}/lib/X11 -X11MANDIR?= ${X11ROOTDIR}/man -X11SHAREDIR?= ${X11ROOTDIR}/share -X11USRLIBDIR?= ${X11ROOTDIR}/lib${MLIBDIR:D/${MLIBDIR}} - -# -# New modular-xorg based builds -# -X11SRCDIRMIT?= ${X11SRCDIR}/external/mit -.for _lib in \ - FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \ - Xdmcp Xevie Xext Xfixes Xfont Xft Xi Xinerama Xmu Xpresent Xpm \ - Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \ - fontenc xkbfile xkbui Xaw Xfontcache pciaccess xcb \ - pthread-stubs -X11SRCDIR.${_lib}?= ${X11SRCDIRMIT}/lib${_lib}/dist -.endfor - -.for _proto in \ - xcmisc xext xf86bigfont bigreqs input kb x fonts fixes scrnsaver \ - xinerama dri2 dri3 render resource record video xf86dga xf86misc \ - xf86vidmode composite damage trap gl randr fontcache xf86dri \ - present xcb- -X11SRCDIR.${_proto}proto?= ${X11SRCDIRMIT}/${_proto}proto/dist -.endfor - -.for _dir in \ - xtrans fontconfig freetype evieext mkfontscale bdftopcf \ - xkbcomp xorg-cf-files imake xorg-server xbiff xkeyboard-config \ - xbitmaps appres xeyes xev xedit sessreg pixman \ - beforelight bitmap editres makedepend fonttosfnt fslsfonts fstobdf \ - glu glw mesa-demos MesaGLUT MesaLib MesaLib7 \ - ico iceauth listres lndir \ - luit xproxymanagementprotocol mkfontdir oclock proxymngr rgb \ - rstart setxkbmap showfont smproxy twm viewres \ - x11perf xauth xcalc xclipboard \ - xclock xcmsdb xconsole xditview xdpyinfo xdriinfo xdm \ - xfd xf86dga xfindproxy xfontsel xfwp xgamma xgc xhost xinit \ - xkill xload xlogo xlsatoms xlsclients xlsfonts xmag xmessage \ - xmh xmodmap xmore xman xprop xrandr xrdb xrefresh xset \ - xsetmode xsetpointer xsetroot xsm xstdcmap xvidtune xvinfo \ - xwininfo xwud xkbprint xkbevd \ - xterm xwd xfs xfsinfo xtrap xkbutils xkbcomp \ - xkeyboard-config xinput xcb-util xorg-docs \ - font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi \ - font-adobe-utopia-75dpi font-adobe-utopia-type1 \ - font-alias \ - font-bh-100dpi font-bh-75dpi font-bh-lucidatypewriter-100dpi \ - font-bh-lucidatypewriter-75dpi font-bh-ttf font-bh-type1 \ - font-bitstream-100dpi font-bitstream-75dpi font-bitstream-type1 \ - font-cursor-misc font-daewoo-misc font-dec-misc font-ibm-type1 \ - font-isas-misc font-jis-misc font-misc-misc font-mutt-misc \ - font-sony-misc font-util ttf-bitstream-vera encodings -X11SRCDIR.${_dir}?= ${X11SRCDIRMIT}/${_dir}/dist -.endfor - -.for _i in \ - elographics keyboard mouse synaptics vmmouse void ws -X11SRCDIR.xf86-input-${_i}?= ${X11SRCDIRMIT}/xf86-input-${_i}/dist -.endfor - -.for _v in \ - ag10e apm ark ast ati ati-kms chips cirrus crime \ - geode glint i128 i740 igs imstt intel intel-old mach64 mga \ - neomagic newport nsc nv nvxbox openchrome pnozz \ - r128 radeonhd rendition \ - s3 s3virge savage siliconmotion sis suncg14 \ - suncg6 sunffb sunleo suntcx \ - tdfx tga trident tseng vesa vga vmware wsfb xgi -X11SRCDIR.xf86-video-${_v}?= ${X11SRCDIRMIT}/xf86-video-${_v}/dist -.endfor - -# Only install the radeon firmware on DRM-happy systems. -.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" -MKRADEONFIRMWARE?= yes -.endif -MKRADEONFIRMWARE?= no - -X11DRI?= yes -X11LOADABLE?= yes - - -# -# Where extsrc sources are and where it is installed to. -# -.if !defined(EXTSRCSRCDIR) -.if exists(${NETBSDSRCDIR}/../extsrc) -EXTSRCSRCDIR!= cd "${NETBSDSRCDIR}/../extsrc" && pwd -.else -EXTSRCSRCDIR= /usr/extsrc -.endif -.endif # !defined(EXTSRCSRCDIR) - -EXTSRCROOTDIR?= /usr/ext -EXTSRCBINDIR?= ${EXTSRCROOTDIR}/bin -EXTSRCETCDIR?= /etc/ext -EXTSRCINCDIR?= ${EXTSRCROOTDIR}/include -EXTSRCLIBDIR?= ${EXTSRCROOTDIR}/lib/ext -EXTSRCMANDIR?= ${EXTSRCROOTDIR}/man -EXTSRCUSRLIBDIR?= ${EXTSRCROOTDIR}/lib - -# -# MAKEDIRTARGET dir target [extra make(1) params] -# run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message -# -MAKEDIRTARGETENV?= -MAKEDIRTARGET=\ - @_makedirtarget() { \ - dir="$$1"; shift; \ - target="$$1"; shift; \ - case "$${dir}" in \ - /*) this="$${dir}/"; \ - real="$${dir}" ;; \ - .) this="${_THISDIR_}"; \ - real="${.CURDIR}" ;; \ - *) this="${_THISDIR_}$${dir}/"; \ - real="${.CURDIR}/$${dir}" ;; \ - esac; \ - show=$${this:-.}; \ - echo "$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \ - cd "$${real}" \ - && ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \ - }; \ - _makedirtarget - -# -# MAKEVERBOSE support. Levels are: -# 0 Minimal output ("quiet") -# 1 Describe what is occurring -# 2 Describe what is occurring and echo the actual command -# 3 Ignore the effect of the "@" prefix in make commands -# 4 Trace shell commands using the shell's -x flag -# -MAKEVERBOSE?= 2 - -.if ${MAKEVERBOSE} == 0 -_MKMSG?= @\# -_MKSHMSG?= : echo -_MKSHECHO?= : echo -.SILENT: -.elif ${MAKEVERBOSE} == 1 -_MKMSG?= @echo ' ' -_MKSHMSG?= echo ' ' -_MKSHECHO?= : echo -.SILENT: -.else # MAKEVERBOSE >= 2 -_MKMSG?= @echo '\# ' -_MKSHMSG?= echo '\# ' -_MKSHECHO?= echo -.SILENT: __makeverbose_dummy_target__ -.endif # MAKEVERBOSE >= 2 -.if ${MAKEVERBOSE} >= 3 -.MAKEFLAGS: -dl -.endif # ${MAKEVERBOSE} >= 3 -.if ${MAKEVERBOSE} >= 4 -.MAKEFLAGS: -dx -.endif # ${MAKEVERBOSE} >= 4 - -_MKMSG_BUILD?= ${_MKMSG} " build " -_MKMSG_CREATE?= ${_MKMSG} " create " -_MKMSG_COMPILE?= ${_MKMSG} "compile " -_MKMSG_FORMAT?= ${_MKMSG} " format " -_MKMSG_INSTALL?= ${_MKMSG} "install " -_MKMSG_LINK?= ${_MKMSG} " link " -_MKMSG_LEX?= ${_MKMSG} " lex " -_MKMSG_REMOVE?= ${_MKMSG} " remove " -_MKMSG_YACC?= ${_MKMSG} " yacc " - -_MKSHMSG_CREATE?= ${_MKSHMSG} " create " -_MKSHMSG_INSTALL?= ${_MKSHMSG} "install " - -_MKTARGET_BUILD?= ${_MKMSG_BUILD} ${.CURDIR:T}/${.TARGET} -_MKTARGET_CREATE?= ${_MKMSG_CREATE} ${.CURDIR:T}/${.TARGET} -_MKTARGET_COMPILE?= ${_MKMSG_COMPILE} ${.CURDIR:T}/${.TARGET} -_MKTARGET_FORMAT?= ${_MKMSG_FORMAT} ${.CURDIR:T}/${.TARGET} -_MKTARGET_INSTALL?= ${_MKMSG_INSTALL} ${.TARGET} -_MKTARGET_LINK?= ${_MKMSG_LINK} ${.CURDIR:T}/${.TARGET} -_MKTARGET_LEX?= ${_MKMSG_LEX} ${.CURDIR:T}/${.TARGET} -_MKTARGET_REMOVE?= ${_MKMSG_REMOVE} ${.TARGET} -_MKTARGET_YACC?= ${_MKMSG_YACC} ${.CURDIR:T}/${.TARGET} - -.if ${MKMANDOC} == "yes" -TARGETS+= lintmanpages -.endif - -TESTSBASE= /usr/tests${MLIBDIR:D/${MLIBDIR}} - -.endif # !defined(_BSD_OWN_MK_) diff --git a/src/share/mk/bsd.prog.mk b/src/share/mk/bsd.prog.mk deleted file mode 100644 index ce10cf5..0000000 --- a/src/share/mk/bsd.prog.mk +++ /dev/null @@ -1,789 +0,0 @@ -# $NetBSD: bsd.prog.mk,v 1.292 2015/06/07 15:04:28 matt Exp $ -# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 - -.ifndef HOSTPROG - -.include -.include -.include -.include - -# -# Definitions and targets shared among all programs built by a single -# Makefile. -# - -##### Basic targets -realinstall: proginstall scriptsinstall - -.gdbinit: - rm -f .gdbinit -.if defined(DESTDIR) && !empty(DESTDIR) - echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit -.else - touch .gdbinit -.endif -.for __gdbinit in ${GDBINIT} - echo "source ${__gdbinit}" >> .gdbinit -.endfor - -CLEANFILES+= a.out [Ee]rrs mklog core *.core .gdbinit - -.if defined(SHAREDSTRINGS) -CLEANFILES+=strings -.c.o: - ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c - - @${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif - @rm -f x.c - -.cc.o .cpp.o .cxx.o .C.o: - ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c - - @mv -f x.c x.cc - @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif - @rm -f x.cc -.endif - -.if defined(MKPIE) && (${MKPIE} != "no") -CFLAGS+= ${PIE_CFLAGS} -AFLAGS+= ${PIE_AFLAGS} -LDFLAGS+= ${PIE_LDFLAGS} -.endif - -CFLAGS+= ${COPTS} -.if defined(MKDEBUG) && (${MKDEBUG} != "no") -CFLAGS+= -g -.endif -OBJCFLAGS+= ${OBJCOPTS} -MKDEP_SUFFIXES?= .o .ln .d - -# CTF preserve debug symbols -.if (${MKCTF:Uno} != "no") && (${CFLAGS:M-g} != "") -CTFFLAGS+= -g -CTFMFLAGS+= -g -.if defined(HAVE_GCC) && ${HAVE_GCC} >= 48 -#CFLAGS+=-gdwarf-2 -.endif -.endif - -# ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o -.ifndef LIBCRTBEGIN -LIBCRTBEGIN= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o ${_GCC_CRTBEGIN} -.MADE: ${LIBCRTBEGIN} -.endif -.ifndef LIBCRTEND -LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtn.o -.MADE: ${LIBCRTEND} -.endif -_SHLINKER= ${SHLINKDIR}/ld.elf_so - -.ifndef LIBCRT0 -LIBCRT0= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crt0.o -.MADE: ${LIBCRT0} -.endif - -.ifndef LIBCRTI -LIBCRTI= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o -.MADE: ${LIBCRTI} -.endif - -##### Installed system library definitions -# -# E.g. -# LIBC?=${DESTDIR}/usr/lib/libc.a -# LIBX11?=${DESTDIR}/usr/X11R7/lib/libX11.a -# etc.. -# NB: If you are a library here, add it in bsd.README - -.for _lib in \ - archive \ - asn1 \ - atf_c \ - atf_cxx \ - bind9 \ - bluetooth \ - bsdmalloc \ - bz2 \ - c \ - c_pic \ - com_err \ - compat \ - crypt \ - crypto \ - crypto_idea \ - crypto_mdc2 \ - crypto_rc5 \ - curses \ - dbm \ - des \ - dns \ - edit \ - event \ - expat \ - fetch \ - fl \ - form \ - g2c \ - gcc \ - gnumalloc \ - gssapi \ - hdb \ - heimbase \ - heimntlm \ - hx509 \ - intl \ - ipsec \ - isc \ - isccc \ - isccfg \ - kadm5clnt \ - kadm5srv \ - kafs \ - krb5 \ - kvm \ - l \ - lber \ - ldap \ - ldap_r \ - lua \ - lwres \ - m \ - magic \ - menu \ - objc \ - ossaudio \ - pam \ - pcap \ - pci \ - pmc \ - posix \ - pthread \ - pthread_dbg \ - puffs \ - quota \ - radius \ - resolv \ - rmt \ - roken \ - rpcsvc \ - rt \ - rump \ - rumpfs_cd9660fs \ - rumpfs_efs \ - rumpfs_ext2fs \ - rumpfs_ffs \ - rumpfs_hfs \ - rumpfs_lfs \ - rumpfs_msdosfs \ - rumpfs_nfs \ - rumpfs_ntfs \ - rumpfs_syspuffs \ - rumpfs_tmpfs \ - rumpfs_udf \ - rumpfs_ufs \ - rumpuser \ - saslc \ - skey \ - sl \ - sqlite3 \ - ss \ - ssh \ - ssl \ - ssp \ - stdcxx \ - supcxx \ - terminfo \ - tre \ - usbhid \ - util \ - wind \ - wrap \ - y \ - z - -.ifndef LIB${_lib:tu} -LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a -.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded -.endif -.endfor - -# Minix libraries -.for _lib in \ - audiodriver \ - bdev \ - blockdriver \ - chardriver \ - clkconf \ - ddekit \ - ddekit_usb_client \ - ddekit_usb_server \ - devman \ - elf \ - exec \ - fsdriver \ - gpio \ - hgfs \ - i2cdriver \ - inputdriver \ - lwip \ - minc \ - minixfs \ - mthread \ - netdriver \ - sffs \ - sockdriver \ - sockevent \ - sys \ - timers \ - usb \ - vboxfs \ - virtio \ - vtreefs -.ifndef LIB${_lib:tu} -LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a -.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded -.endif -.endfor - -# PAM applications, if linked statically, need more libraries -.if (${MKPIC} == "no") -.if (${MKCRYPTO} != "no") -PAM_STATIC_LDADD+= -lssh -PAM_STATIC_DPADD+= ${LIBSSH} -.endif -.if (${MKKERBEROS} != "no") -PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \ - -lroken -lcom_err -lheimbase -lcrypto -PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \ - ${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO} -.endif -.if (${MKSKEY} != "no") -PAM_STATIC_LDADD+= -lskey -PAM_STATIC_DPADD+= ${LIBSKEY} -.endif -PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil -PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL} -.else -PAM_STATIC_LDADD= -PAM_STATIC_DPADD= -.endif - -.if defined(__MINIX) && ${MACHINE_ARCH} == "earm" -# LSC: On ARM, when compiling statically, with gcc, lgcc_eh is required -LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:} -.endif # defined(__MINIX) && ${MACHINE_ARCH} == "earm" - -# NB: If you are a library here, add it in bsd.README -.for _lib in \ - FS \ - GL \ - GLU \ - ICE \ - SM \ - X11 \ - XTrap \ - Xau \ - Xaw \ - Xdmcp \ - Xext \ - Xfont \ - Xft \ - Xi \ - Xinerama \ - Xmu \ - Xmuu \ - Xpm \ - Xrandr \ - Xrender \ - Xss \ - Xt \ - Xtst \ - Xv \ - Xxf86dga \ - Xxf86misc \ - Xxf86vm \ - dps \ - fntstubs \ - fontcache \ - fontconfig \ - fontenc \ - freetype \ - lbxutil \ - xkbfile -.ifndef LIB${_lib:tu} -LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a -.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded -.endif -.endfor - -# Ugly one-offs -LIBX11_XCB= ${DESTDIR}${X11USRLIBDIR}/libX11-xcb.a -LIBXCB= ${DESTDIR}${X11USRLIBDIR}/libxcb.a - -.if defined(RESCUEDIR) -CPPFLAGS+= -DRESCUEDIR=\"${RESCUEDIR}\" -.endif - -_PROGLDOPTS= -.if ${SHLINKDIR} != "/usr/libexec" # XXX: change or remove if ld.so moves -_PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER} -.endif -.if ${SHLIBDIR} != "/usr/lib" -_PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ - -L=${SHLIBDIR} -.elif ${SHLIBINSTALLDIR} != "/usr/lib" -_PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ - -L=${SHLIBINSTALLDIR} -.endif - -__proginstall: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${STRIPFLAG} ${.ALLSRC} ${.TARGET} - -__progrumpinstall: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${RUMPBINOWN} -g ${RUMPBINGRP} -m ${RUMPBINMODE} \ - ${STRIPFLAG} ${.ALLSRC} ${.TARGET} - -__progdebuginstall: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \ - ${.ALLSRC} ${.TARGET} - - - -# -# Backwards compatibility with Makefiles that assume that bsd.prog.mk -# can only build a single binary. -# - -_APPEND_MANS=yes -_APPEND_SRCS=yes - -_CCLINKFLAGS= - -.if defined(PROG_CXX) -PROG= ${PROG_CXX} -_CCLINK= ${CXX} ${_CCLINKFLAGS} - -.if defined(__MINIX) -# BJG - stack unwinding (for C++ exceptions) doesn't work on static executables when built with llvm. -LDSTATIC= -dynamic -.endif # defined(__MINIX) -.endif - -.if defined(RUMPPRG) -PROG= ${RUMPPRG} -. ifndef CRUNCHEDPROG -. if (${MKRUMP} != "no") -PROGS= ${RUMPPRG} rump.${RUMPPRG} -. else -PROGS= ${RUMPPRG} -. endif -. if defined(SRCS) -. if (${MKRUMP} != "no") -SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS} -. endif -SRCS+= ${PROG}_hostops.c -. else -SRCS= ${PROG}.c ${PROG}_hostops.c -. if (${MKRUMP} != "no") -SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS} -. endif -. endif -. if (${MKRUMP} != "no") -DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS} -LDADD.rump.${PROG}+= -lrumpclient -DPADD.rump.${PROG}+= ${LIBRUMPCLIENT} -MAN.rump.${PROG}= # defined but feeling empty -_RUMPINSTALL.rump.${PROG}=# defined -. endif -. else # CRUNCHEDPROG -PROGS= ${PROG} -CPPFLAGS+= -DCRUNCHOPS -. endif -.endif - -.if defined(PROG) -_CCLINK?= ${CC} ${_CCLINKFLAGS} -. if defined(MAN) -MAN.${PROG}= ${MAN} -_APPEND_MANS= no -. endif -. if !defined(OBJS) -OBJS= ${OBJS.${PROG}} -. endif -. if defined(PROGNAME) -PROGNAME.${PROG}= ${PROGNAME} -. endif -. if defined(SRCS) -SRCS.${PROG}= ${SRCS} -_APPEND_SRCS= no -. endif -.endif - -# Turn the single-program PROG and PROG_CXX variables into their multi-word -# counterparts, PROGS and PROGS_CXX. -.if !defined(RUMPPRG) -. if defined(PROG_CXX) && !defined(PROGS_CXX) -PROGS_CXX= ${PROG_CXX} -. elif defined(PROG) && !defined(PROGS) -PROGS= ${PROG} -. endif -.endif - -##### Libraries that this may depend upon. -.if defined(PROGDPLIBS) # { -.for _lib _dir in ${PROGDPLIBS} -.if !defined(BINDO.${_lib}) -PROGDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} -.MAKEOVERRIDES+=PROGDO.${_lib} -.endif -LDADD+= -L${PROGDO.${_lib}} -l${_lib} -.if exists(${PROGDO.${_lib}}/lib${_lib}_pic.a) -DPADD+= ${PROGDO.${_lib}}/lib${_lib}_pic.a -.elif exists(${PROGDO.${_lib}}/lib${_lib}.so) -DPADD+= ${PROGDO.${_lib}}/lib${_lib}.so -.else -DPADD+= ${PROGDO.${_lib}}/lib${_lib}.a -.endif -.endfor -.endif # } -# -# Per-program definitions and targets. -# - -_CCLINK.CDEFAULT= ${CC} ${_CCLINKFLAGS} -# Definitions specific to C programs. -.for _P in ${PROGS} -SRCS.${_P}?= ${_P}.c -_CCLINK.${_P}= ${CC} ${_CCLINKFLAGS} -_CFLAGS.${_P}= ${CFLAGS} ${CPUFLAGS} -_CPPFLAGS.${_P}= ${CPPFLAGS} -_COPTS.${_P}= ${COPTS} -.endfor - -_CCLINK.CXXDEFAULT= ${CXX} ${_CCLINKFLAGS} -# Definitions specific to C++ programs. -.for _P in ${PROGS_CXX} -SRCS.${_P}?= ${_P}.cc -_CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS} -.endfor - -# Language-independent definitions. -.if defined(__MINIX) -.if ${USE_BITCODE:Uno} == "yes" -CFLAGS+= -flto -.endif # ${USE_BITCODE:Uno} == "yes" - -.if ${USE_BITCODE:Uyes} == "no" -#LSC Gold linker seems to require the library directory to be set up if -# a sysroot parameter has been given. -LDFLAGS+= -L ${DESTDIR}/usr/lib -.endif # ${USE_BITCODE:U} == "no" -.endif # defined(__MINIX) - -.for _P in ${PROGS} ${PROGS_CXX} # { - -BINDIR.${_P}?= ${BINDIR} -PROGNAME.${_P}?= ${_P} - -.if ${MKDEBUG} != "no" && !commands(${_P}) -_PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug -.endif - -.if defined(PAXCTL_FLAGS) -PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS} -.endif - -##### PROG specific flags. - -_DPADD.${_P}= ${DPADD} ${DPADD.${_P}} -_LDADD.${_P}= ${LDADD} ${LDADD.${_P}} -_LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}} -_LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}} - -##### Build and install rules -.if !empty(_APPEND_SRCS:M[Yy][Ee][Ss]) -SRCS+= ${SRCS.${_P}} # For bsd.dep.mk -.endif - -_YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}} - -DPSRCS+= ${_YPSRCS.${_P}} -CLEANFILES+= ${_YPSRCS.${_P}} - -.if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth) -OBJS.${_P}+= ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g} -LOBJS.${_P}+= ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln} -.endif - -.if defined(OBJS.${_P}) && !empty(OBJS.${_P}) # { -.NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}} - -.if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \ - && (${_CCLINK.${_P}} == ${_CCLINK.CDEFAULT} \ - || ${_CCLINK.${_P}} == ${_CCLINK.CXXDEFAULT}) \ - && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE)) -.for f in ${SRCS.${_P}:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g} -#_XFLAGS.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} \ -# ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5} -.if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \ - || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \ - || ${CXXFLAGS.$f:D5} == "5") \ - || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/})) -XOBJS.${_P}+= ${f:R:S/$/.o/} -.else -XSRCS.${_P}+= ${f} -NODPSRCS+= ${f} -.endif -.endfor - -${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${XOBJS.${_P}} ${SRCS.${_P}} \ - ${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}} - ${_MKTARGET_LINK} -.if defined(DESTDIR) - ${_CCLINK.${_P}} -Wl,-nostdlib \ - ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \ - -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \ - -MD --combine ${_CPPFLAGS.${_P}} ${_CFLAGS.${_P}} ${_COPTS.${_P}} \ - ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \ - ${_LDADD.${_P}} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib -.else - ${_CCLINK.${_P}} ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \ - -MD --combine ${_CPPFLAGS.${_P}} ${_COPTS.${_P}} - ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \ - ${_LDADD.${_P}} -.endif # defined(DESTDIR) -.if defined(CTFMERGE) - ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}} -.endif -.if defined(PAXCTL_FLAGS.${_P}) - ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET} -.endif -.if ${MKSTRIPIDENT} != "no" - ${OBJCOPY} -R .ident ${.TARGET} -.endif - -CLEANFILES+= ${_P}.d -.if exists(${_P}.d) -.include "${_P}.d" # include -MD depend for program. -.endif -.else # USE_COMBINE - -${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS} - -.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" -CLEANFILES+= ${_P}.opt.bcl ${_P}.bcl ${_P}.bcl.o - -OPTFLAGS.${_P}?= ${OPTFLAGS} -BITCODE_LD_FLAGS_1ST.${_P}+= ${BITCODE_LD_FLAGS_1ST} -BITCODE_LD_FLAGS_2ND.${_P}+= ${BITCODE_LD_FLAGS_2ND} - -${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ - ${LIBCRTEND} ${_DPADD.${_P}} - ${_MKTARGET_LINK} - ${_CCLINK.${_P}} \ - -o ${.TARGET} \ - -nostartfiles \ - -L${DESTDIR}/usr/lib/bc \ - ${OBJS.${_P}} ${LLVM_LINK_ARGS} ${_LDADD.${_P}:N-shared} \ - ${_LDSTATIC.${_P}} ${_PROGLDOPTS} \ - -Wl,-r \ - ${BITCODE_LD_FLAGS_1ST.${_P}} \ - -Wl,-plugin-opt=emit-llvm - -${_P}.opt.bcl: ${_P}.bcl ${LLVM_PASS} - ${_MKTARGET_LINK} - ${OPT} ${OPTFLAGS.${_P}} -o ${.TARGET} ${_P}.bcl - -${_P}.bcl.o: ${_P}.opt.bcl - ${_MKTARGET_LINK} - ${LLC} -O1 -march=x86 -mcpu=i586 -filetype=obj -o ${.TARGET} ${.ALLSRC} - -${_P}: ${_P}.bcl.o -.if !commands(${_P}) - ${_MKTARGET_LINK} - ${_CCLINK.${_P}} \ - ${_LDFLAGS.${_P}} \ - -L${DESTDIR}/usr/lib \ - ${_LDSTATIC.${_P}} -o ${.TARGET} \ - ${.TARGET}.bcl.o ${_PROGLDOPTS} ${_LDADD.${_P}} \ - ${BITCODE_LD_FLAGS_2ND.${_P}} \ - -Wl,--allow-multiple-definition -.endif # !commands(${_P}) - -.else -${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ - ${LIBCRTEND} ${_DPADD.${_P}} -.if !commands(${_P}) - ${_MKTARGET_LINK} - ${_CCLINK.${_P}} \ - ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \ - ${OBJS.${_P}} ${_PROGLDOPTS} ${_LDADD.${_P}} -.if defined(CTFMERGE) - ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}} -.endif -.if defined(PAXCTL_FLAGS.${_P}) - ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET} -.endif -.if ${MKSTRIPIDENT} != "no" - ${OBJCOPY} -R .ident ${.TARGET} -.endif -.endif # !commands(${_P}) -.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" -.endif # USE_COMBINE - -${_P}.ro: ${OBJS.${_P}} ${_DPADD.${_P}} - ${_MKTARGET_LINK} - ${CC} ${LDFLAGS:N-Wl,-pie} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}} - -.if defined(_PROGDEBUG.${_P}) -${_PROGDEBUG.${_P}}: ${_P} - ${_MKTARGET_CREATE} - ( ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \ - && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ - --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \ - ) || (rm -f ${_PROGDEBUG.${_P}}; false) -.endif - -.endif # defined(OBJS.${_P}) && !empty(OBJS.${_P}) # } - -.if !defined(MAN.${_P}) -MAN.${_P}= ${_P}.1 -.endif # !defined(MAN.${_P}) -.if !empty(_APPEND_MANS:M[Yy][Ee][Ss]) -MAN+= ${MAN.${_P}} -.endif - -realall: ${_P} ${_PROGDEBUG.${_P}} - -CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}} - -.if defined(OBJS.${_P}) && !empty(OBJS.${_P}) -CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}} -.endif - -_PROG_INSTALL+= proginstall-${_P} - -.if !target(proginstall-${_P}) # { -proginstall-${_P}:: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \ - ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}} -.PRECIOUS: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \ - ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}} - -.if ${MKUPDATE} == "no" -.if defined(_RUMPINSTALL.${_P}) -${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall -.else -${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall -.endif -.if !defined(BUILD) && !make(all) && !make(${_P}) -${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE -.endif -.if defined(_PROGDEBUG.${_P}) -${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall -.if !defined(BUILD) && !make(all) && !make(${_P}) -${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE -.endif -.endif # define(_PROGDEBUG.${_P}) -.else # MKUPDATE != no -.if defined(_RUMPINSTALL.${_P}) -${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall -.else -${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall -.endif -.if !defined(BUILD) && !make(all) && !make(${_P}) -${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE -.endif -.if defined(_PROGDEBUG.${_P}) -${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall -.if !defined(BUILD) && !make(all) && !make(${_P}) -${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE -.endif -.endif # defined(_PROGDEBUG.${_P}) -.endif # MKUPDATE != no - -.endif # !target(proginstall-${_P}) # } - -lint: lint-${_P} -lint-${_P}: ${LOBJS.${_P}} -.if defined(LOBJS.${_P}) && !empty(LOBJS.${_P}) - ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}} -.endif - -.endfor # _P in ${PROGS} ${PROGS_CXX} # } - -.if defined(OBJS) && !empty(OBJS) && \ - (empty(PROGS) && empty(PROGS_CXX)) -CLEANFILES+= ${OBJS} ${LOBJS} -.endif - -.if !target(proginstall) -proginstall:: ${_PROG_INSTALL} -.endif -.PHONY: proginstall - - - -realall: ${SCRIPTS} -.if defined(SCRIPTS) && !target(scriptsinstall) # { -SCRIPTSDIR?=${BINDIR} -SCRIPTSOWN?=${BINOWN} -SCRIPTSGRP?=${BINGRP} -SCRIPTSMODE?=${BINMODE} - -scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@} -.PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@} - -__scriptinstall: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} \ - -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \ - -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \ - -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \ - ${.ALLSRC} ${.TARGET} - -.for S in ${SCRIPTS:O:u} -.if ${MKUPDATE} == "no" -${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall -.if !defined(BUILD) && !make(all) && !make(${S}) -${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE -.endif -.else -${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall -.if !defined(BUILD) && !make(all) && !make(${S}) -${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE -.endif -.endif -.endfor -.endif # } - -.if !target(scriptsinstall) -scriptsinstall:: -.endif -.PHONY: scriptsinstall - -##### Pull in related .mk logic -LINKSOWN?= ${BINOWN} -LINKSGRP?= ${BINGRP} -LINKSMODE?= ${BINMODE} -.include -.include -.include -.include -.include -.include -.include -.include -.include - -${TARGETS}: # ensure existence - -.endif # HOSTPROG diff --git a/src/share/mk/bsd.rpc.mk b/src/share/mk/bsd.rpc.mk deleted file mode 100644 index 39d8c41..0000000 --- a/src/share/mk/bsd.rpc.mk +++ /dev/null @@ -1,76 +0,0 @@ -# $NetBSD: bsd.rpc.mk,v 1.13 2013/12/15 00:28:45 christos Exp $ - -.include - -RPC_XDIR?= ${.CURDIR}/ -RPCGEN_FLAGS?= -B - -# We don't use implicit suffix rules here to avoid dependencies in the -# Installed files. - -.if defined(RPC_INCS) # { - -.for I in ${RPC_INCS} -${I}: ${I:.h=.x} - ${_MKTARGET_CREATE} - ${TOOL_RPCGEN} ${RPCGEN_FLAGS} -h ${RPC_XDIR}${I:.h=.x} -o ${.TARGET} -.endfor - -DPSRCS+= ${RPC_INCS} -CLEANFILES+= ${RPC_INCS} - -.endif # } - - -.if defined(RPC_XDRFILES) # { - -.for I in ${RPC_XDRFILES} -${I}: ${RPC_XDIR}${I:_xdr.c=.x} - ${_MKTARGET_CREATE} - ${TOOL_RPCGEN} ${RPCGEN_FLAGS} -c ${RPC_XDIR}${I:_xdr.c=.x} -o ${.TARGET} -.endfor - -DPSRCS+= ${RPC_XDRFILES} -CLEANFILES+= ${RPC_XDRFILES} - -.endif # } - - -.if defined(RPC_SVCFILES) # { - -.for I in ${RPC_SVCCLASS} -_RPCS += -s ${I} -.endfor - -.for I in ${RPC_SVCFILES} - -${I}: ${RPC_XDIR}${I:_svc.c=.x} - ${_MKTARGET_CREATE} - ${TOOL_RPCGEN} ${RPCGEN_FLAGS} ${_RPCS} ${RPC_SVCFLAGS} ${RPC_XDIR}${I:_svc.c=.x} \ - -o ${.TARGET} -.endfor - -DPSRCS+= ${RPC_SVCFILES} -CLEANFILES+= ${RPC_SVCFILES} - -.endif # } - -.if defined(RPC_CLNTFILES) # { - -.for I in ${RPC_CLNTFILES} - -${I}: ${RPC_XDIR}${I:_clnt.c=.x} - ${_MKTARGET_CREATE} - ${TOOL_RPCGEN} ${RPCGEN_FLAGS} -l ${_RPCS} ${RPC_CLNTFLAGS} \ - ${RPC_XDIR}${I:_clnt.c=.x} -o ${.TARGET} -.endfor - -DPSRCS+= ${RPC_CLNTFILES} -CLEANFILES+= ${RPC_CLNTFILES} - -.endif # } - -##### Pull in related .mk logic -.include -.include -.include diff --git a/src/share/mk/bsd.shlib.mk b/src/share/mk/bsd.shlib.mk deleted file mode 100644 index bb058c2..0000000 --- a/src/share/mk/bsd.shlib.mk +++ /dev/null @@ -1,40 +0,0 @@ -# $NetBSD: bsd.shlib.mk,v 1.8 2012/08/23 21:21:17 joerg Exp $ - -.if !defined(_BSD_SHLIB_MK_) -_BSD_SHLIB_MK_=1 - -.if ${MKDYNAMICROOT} == "no" -SHLIBINSTALLDIR?= /usr/lib -.else -SHLIBINSTALLDIR?= /lib -.endif - -.if ${MKDYNAMICROOT} == "no" || \ - (${BINDIR:Ux} != "/bin" && ${BINDIR:Ux} != "/sbin" && \ - ${BINDIR:Ux} != "/libexec" && ${USE_SHLIBDIR:Uno} == "no") -SHLIBDIR?= /usr/lib -.else -SHLIBDIR?= /lib -.endif - -.if ${USE_SHLIBDIR:Uno} != "no" -_LIBSODIR?= ${SHLIBINSTALLDIR} -.else -_LIBSODIR?= ${LIBDIR} -.endif - -.if ${MKDYNAMICROOT} == "no" -SHLINKINSTALLDIR?= /usr/libexec -.else -SHLINKINSTALLDIR?= /libexec -.endif - -.if ${MKDYNAMICROOT} == "no" || \ - (${BINDIR:Ux} != "/bin" && ${BINDIR:Ux} != "/sbin" && \ - ${BINDIR:Ux} != "/libexec") -SHLINKDIR?= /usr/libexec -.else -SHLINKDIR?= /libexec -.endif - -.endif # !defined(_BSD_SHLIB_MK_) diff --git a/src/share/mk/bsd.subdir.mk b/src/share/mk/bsd.subdir.mk deleted file mode 100644 index 0692f40..0000000 --- a/src/share/mk/bsd.subdir.mk +++ /dev/null @@ -1,59 +0,0 @@ -# $NetBSD: bsd.subdir.mk,v 1.52 2010/05/26 00:48:15 uwe Exp $ -# @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93 - -.include - -.if !defined(NOSUBDIR) # { - -.for dir in ${SUBDIR} -.if "${dir}" == ".WAIT" -# Don't play with .WAIT -__REALSUBDIR+=${dir} -.else -.if "${dir:H}" != "" -# It is a relative path; make it absolute so exists can't search the path. -.if exists(${.CURDIR}/${dir}.${MACHINE}) -__REALSUBDIR+=${dir}.${MACHINE} -.else -__REALSUBDIR+=${dir} -.endif -.else -# It is an absolute path; leave it alone -.if exists(${dir}.${MACHINE}) -__REALSUBDIR+=${dir}.${MACHINE} -.else -__REALSUBDIR+=${dir} -.endif -.endif -.endif -.endfor - -__recurse: .USE - @${MAKEDIRTARGET} ${.TARGET:C/^[^-]*-//} ${.TARGET:C/-.*$//} - -.if make(cleandir) -__RECURSETARG= ${TARGETS:Nclean} -clean: -.else -__RECURSETARG= ${TARGETS} -.endif - -# for obscure reasons, we can't do a simple .if ${dir} == ".WAIT" -# but have to assign to __TARGDIR first. -.for targ in ${__RECURSETARG} -.for dir in ${__REALSUBDIR} -__TARGDIR := ${dir} -.if ${__TARGDIR} == ".WAIT" -SUBDIR_${targ} += .WAIT -.elif !commands(${targ}-${dir}) -${targ}-${dir}: .PHONY .MAKE __recurse -SUBDIR_${targ} += ${targ}-${dir} -.endif -.endfor -subdir-${targ}: .PHONY ${SUBDIR_${targ}} -${targ}: subdir-${targ} -.endfor - -.endif # ! NOSUBDIR # } - -${TARGETS}: # ensure existence diff --git a/src/share/mk/bsd.sys.mk b/src/share/mk/bsd.sys.mk deleted file mode 100644 index 322fc2d..0000000 --- a/src/share/mk/bsd.sys.mk +++ /dev/null @@ -1,289 +0,0 @@ -# $NetBSD: bsd.sys.mk,v 1.245 2014/09/03 19:22:53 matt Exp $ -# -# Build definitions used for NetBSD source tree builds. - -.if !defined(_BSD_SYS_MK_) -_BSD_SYS_MK_=1 - -.if !empty(.INCLUDEDFROMFILE:MMakefile*) -error1: - @(echo "bsd.sys.mk should not be included from Makefiles" >& 2; exit 1) -.endif -.if !defined(_BSD_OWN_MK_) -error2: - @(echo "bsd.own.mk must be included before bsd.sys.mk" >& 2; exit 1) -.endif - -.if defined(__MINIX) -#LSC: Be a bit smarter about the default compiler -.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) -CC?= clang -.endif - -.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) -CC?= gcc -.endif - -MKDEP?= CC=${CC:Q} mkdep -MKDEPCXX?= CC=${CXX:Q} mkdep -.endif # defined(__MINIX) - -.if ${MKREPRO:Uno} == "yes" -CPPFLAGS+= -Wp,-iremap,${NETBSDSRCDIR}:/usr/src -CPPFLAGS+= -Wp,-iremap,${DESTDIR}/:/ -CPPFLAGS+= -Wp,-iremap,${X11SRCDIR}:/usr/xsrc -.endif - -# NetBSD sources use C99 style, with some GCC extensions. -CFLAGS+= ${${ACTIVE_CC} == "clang":? -std=gnu99 :} -CFLAGS+= ${${ACTIVE_CC} == "gcc":? -std=gnu99 :} -CFLAGS+= ${${ACTIVE_CC} == "pcc":? -std=gnu99 :} - -.if defined(WARNS) -CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wno-sign-compare -Wno-pointer-sign :} -.if ${WARNS} > 0 -CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -#CFLAGS+= -Wmissing-declarations -Wredundant-decls -Wnested-externs -# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, -# but our sources aren't up for it yet. Also, add -Wno-traditional because -# gcc includes #elif in the warnings, which is 'this code will not compile -# in a traditional environment' warning, as opposed to 'this code behaves -# differently in traditional and ansi environments' which is the warning -# we wanted, and now we don't get anymore. -CFLAGS+= -Wno-sign-compare -CFLAGS+= ${${ACTIVE_CC} == "gcc" :? -Wno-traditional :} -.if !defined(NOGCCERROR) && !defined(USE_BITCODE) -# Set assembler warnings to be fatal -CFLAGS+= -Wa,--fatal-warnings -.endif -# Set linker warnings to be fatal -# XXX no proper way to avoid "FOO is a patented algorithm" warnings -# XXX on linking static libs -.if (!defined(MKPIC) || ${MKPIC} != "no") && \ - (!defined(LDSTATIC) || ${LDSTATIC} != "-static") -# XXX there are some strange problems not yet resolved -. if defined(HAVE_LLVM) && !defined(USE_BITCODE) -LDFLAGS+= -Wl,--fatal-warnings -. endif -.endif -.endif -.if ${WARNS} > 1 -CFLAGS+= -Wreturn-type -Wswitch -Wshadow -.endif -.if ${WARNS} > 2 -CFLAGS+= -Wcast-qual -Wwrite-strings -CFLAGS+= -Wextra -Wno-unused-parameter -# Readd -Wno-sign-compare to override -Wextra with clang -CFLAGS+= -Wno-sign-compare -CXXFLAGS+= -Wabi -CXXFLAGS+= -Wold-style-cast -CXXFLAGS+= -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \ - -Wno-deprecated -Woverloaded-virtual -Wsign-promo -Wsynth -CXXFLAGS+= ${${ACTIVE_CXX} == "gcc":? -Wno-non-template-friend -Wno-pmf-conversions :} -.endif -.if ${WARNS} > 3 && (defined(HAVE_GCC) || defined(HAVE_LLVM)) -.if ${WARNS} > 4 -CFLAGS+= -Wold-style-definition -.endif -.if ${WARNS} > 5 && !(defined(HAVE_GCC) && ${HAVE_GCC} <= 45) -CFLAGS+= -Wconversion -.endif -CFLAGS+= -Wsign-compare -Wformat=2 -CFLAGS+= ${${ACTIVE_CC} == "gcc":? -Wno-format-zero-length :} -.endif -.if ${WARNS} > 3 && defined(HAVE_LLVM) -CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wpointer-sign -Wmissing-noreturn :} -.endif -.if (defined(HAVE_GCC) \ - && (${MACHINE_ARCH} == "coldfire" || \ - ${MACHINE_ARCH} == "sh3eb" || \ - ${MACHINE_ARCH} == "sh3el" || \ - ${MACHINE_ARCH} == "m68k" || \ - ${MACHINE_ARCH} == "m68000")) -# XXX GCC 4.5 for sh3 and m68k (which we compile with -Os) is extra noisy for -# cases it should be better with -CFLAGS+= -Wno-uninitialized -.if ${HAVE_GCC} >= 48 -CFLAGS+= -Wno-maybe-uninitialized -.endif -.endif -.endif - -CWARNFLAGS+= ${CWARNFLAGS.${ACTIVE_CC}} - -CPPFLAGS+= ${AUDIT:D-D__AUDIT__} -_NOWERROR= ${defined(NOGCCERROR) || (${ACTIVE_CC} == "clang" && defined(NOCLANGERROR)):?yes:no} -.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" -_NOWERROR= yes -.endif # defined(__MINIX) && ${USE_BITCODE} == "yes" -CFLAGS+= ${${_NOWERROR} == "no" :?-Werror:} ${CWARNFLAGS} -LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include} - -.if (${USE_SSP:Uno} != "no") && (${BINDIR:Ux} != "/usr/mdec") -.if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels nor kern modules -CPPFLAGS+= -D_FORTIFY_SOURCE=2 -.endif -COPTS+= -fstack-protector -Wstack-protector - -# gcc 4.8 on m68k erroneously does not protect functions with -# variables needing special alignement, see -# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59674 -# (the underlying issue for sh and vax may be different, needs more -# investigation, symptoms are similar but for different sources) -.if "${ACTIVE_CC}" == "gcc" && "${HAVE_GCC}" == "48" && \ - ( ${MACHINE_CPU} == "sh3" || \ - ${MACHINE_ARCH} == "vax" || \ - ${MACHINE_CPU} == "m68k" || \ - ${MACHINE_CPU} == "or1k" ) -COPTS+= -Wno-error=stack-protector -.endif - -COPTS+= ${${ACTIVE_CC} == "clang":? --param ssp-buffer-size=1 :} -COPTS+= ${${ACTIVE_CC} == "gcc":? --param ssp-buffer-size=1 :} -.endif - -.if ${MKSOFTFLOAT:Uno} != "no" -COPTS+= ${${ACTIVE_CC} == "gcc":? -msoft-float :} -FOPTS+= -msoft-float -.elif ${MACHINE_ARCH} == "coldfire" -COPTS+= -mhard-float -FOPTS+= -mhard-float -.endif - -.if ${MKIEEEFP:Uno} != "no" -.if ${MACHINE_ARCH} == "alpha" -CFLAGS+= -mieee -FFLAGS+= -mieee -.endif -.endif - -.if ${MACHINE} == "sparc64" && ${MACHINE_ARCH} == "sparc" -CFLAGS+= -Wa,-Av8plus -.endif - -.if !defined(NOGCCERROR) -.if (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb") -CPUFLAGS+= -Wa,--fatal-warnings -.endif -.endif - -#.if ${MACHINE} == "sbmips" -#CFLAGS+= -mips64 -mtune=sb1 -#.endif - -#.if (${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") && \ -# (defined(MKPIC) && ${MKPIC} == "no") -#CPUFLAGS+= -mno-abicalls -fno-PIC -#.endif -CFLAGS+= ${CPUFLAGS} -AFLAGS+= ${CPUFLAGS} - -.if !defined(LDSTATIC) || ${LDSTATIC} != "-static" -# Position Independent Executable flags -PIE_CFLAGS?= -fPIC -PIE_LDFLAGS?= -Wl,-pie ${${ACTIVE_CC} == "gcc":? -shared-libgcc :} -PIE_AFLAGS?= -fPIC -.endif - -ELF2ECOFF?= elf2ecoff -MKDEP?= mkdep -MKDEPCXX?= mkdep -OBJCOPY?= objcopy -OBJDUMP?= objdump -PAXCTL?= paxctl -STRIP?= strip - -.SUFFIXES: .o .ln .lo .c .cc .cpp .cxx .C .m ${YHEADER:D.h} - -# C -.c.o: - ${_MKTARGET_COMPILE} - ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif - -.c.ln: - ${_MKTARGET_COMPILE} - ${LINT} ${LINTFLAGS} ${LINTFLAGS.${.IMPSRC:T}} \ - ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ - ${CPPFLAGS.${.IMPSRC:T}:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ - -i ${.IMPSRC} - -# C++ -.cc.o .cpp.o .cxx.o .C.o: - ${_MKTARGET_COMPILE} - ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} - -# Objective C -# (Defined here rather than in because `.m' is not just -# used for Objective C source) -.m.o: - ${_MKTARGET_COMPILE} - ${COMPILE.m} ${OBJCOPTS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif - -# Host-compiled C objects -# The intermediate step is necessary for Sun CC, which objects to calling -# object files anything but *.o -.c.lo: - ${_MKTARGET_COMPILE} - ${HOST_COMPILE.c} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} - mv ${.TARGET}.o ${.TARGET} - -# C++ -.cc.lo .cpp.lo .cxx.lo .C.lo: - ${_MKTARGET_COMPILE} - ${HOST_COMPILE.cc} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} - mv ${.TARGET}.o ${.TARGET} - -# Assembly -.s.o: - ${_MKTARGET_COMPILE} - ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif - -.S.o: - ${_MKTARGET_COMPILE} - ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif - -# Lex -LFLAGS+= ${LPREFIX.${.IMPSRC:T}:D-P${LPREFIX.${.IMPSRC:T}}} -LFLAGS+= ${LPREFIX:D-P${LPREFIX}} - -.l.c: - ${_MKTARGET_LEX} - ${LEX.l} -o${.TARGET} ${.IMPSRC} - -# Yacc -YFLAGS+= ${YPREFIX.${.IMPSRC:T}:D-p${YPREFIX.${.IMPSRC:T}}} ${YHEADER.${.IMPSRC:T}:D-d} -YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} - -.y.c: - ${_MKTARGET_YACC} - ${YACC.y} -o ${.TARGET} ${.IMPSRC} - -.ifdef YHEADER -.if empty(.MAKEFLAGS:M-n) -.y.h: ${.TARGET:.h=.c} -.endif -.endif - -# Objcopy -.if ${MACHINE_ARCH} == aarch64eb -# AARCH64 big endian needs to preserve $x/$d symbols for the linker. -OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][dx]' -K '[$$][dx]\.*' -.elif !empty(MACHINE_ARCH:M*arm*eb) -# ARM big endian needs to preserve $a/$d/$t symbols for the linker. -OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][adt]' -K '[$$][adt]\.*' -.endif -OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} ${OBJCOPYLIBFLAGS_EXTRA} - -.endif # !defined(_BSD_SYS_MK_) diff --git a/src/share/mk/bsd.syscall.mk b/src/share/mk/bsd.syscall.mk deleted file mode 100644 index 6a3e160..0000000 --- a/src/share/mk/bsd.syscall.mk +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: bsd.syscall.mk,v 1.2 2014/01/16 01:19:46 christos Exp $ -# -.include - -SYSCALL_OBJS?= ${SYSCALL_PREFIX}_sysent.c ${SYSCALL_PREFIX}_syscalls.c \ - ${SYSCALL_PREFIX}_syscall.h ${SYSCALL_PREFIX}_syscallargs.h - -SYSCALL_DEPS?= ${NETBSDSRCDIR}/sys/kern/makesyscalls.sh \ - syscalls.conf syscalls.master - -all: ${SYSCALL_OBJS} - -${SYSCALL_OBJS}: ${SYSCALL_DEPS} - ${HOST_SH} ${.ALLSRC} - -.include diff --git a/src/share/mk/bsd.test.mk b/src/share/mk/bsd.test.mk deleted file mode 100644 index 7f9954d..0000000 --- a/src/share/mk/bsd.test.mk +++ /dev/null @@ -1,207 +0,0 @@ -# $NetBSD: bsd.test.mk,v 1.24 2013/02/23 22:01:51 jmmv Exp $ -# - -.include - -_TESTS:= # empty - -.if defined(TESTS_SUBDIRS) -SUBDIR+= ${TESTS_SUBDIRS} -.endif - -.include - -.if defined(TESTS_C) -_TESTS+= ${TESTS_C} -PROGS+= ${TESTS_C} -. for _T in ${TESTS_C} -BINDIR.${_T}= ${TESTSDIR} -LDADD.${_T}+= -latf-c -DPADD.${_T}+= ${LIBATF_C} -MAN.${_T}?= # empty -. endfor -.endif - -.if defined(TESTS_CXX) -_TESTS+= ${TESTS_CXX} -PROGS_CXX+= ${TESTS_CXX} -. for _T in ${TESTS_CXX} -BINDIR.${_T}= ${TESTSDIR} -LDADD.${_T}+= -latf-c++ -latf-c -DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C} -MAN.${_T}?= # empty -. endfor -.endif - -.if defined(TESTS_SH) -_TESTS+= ${TESTS_SH} -CLEANDIRFILES+= ${TESTS_SH} - -. for _T in ${TESTS_SH} -SCRIPTS+= ${_T} -SCRIPTSDIR_${_T}= ${TESTSDIR} - -CLEANDIRFILES+= ${_T}.tmp - -TESTS_SH_SRC_${_T}?= ${_T}.sh -${_T}: ${TESTS_SH_SRC_${_T}} - ${_MKTARGET_BUILD} - echo '#! /usr/bin/atf-sh' >${.TARGET}.tmp - cat ${.ALLSRC} >>${.TARGET}.tmp - chmod +x ${.TARGET}.tmp - mv ${.TARGET}.tmp ${.TARGET} -. endfor -.endif - -ATFFILE?= auto -.if ${MKKYUA} != "no" -KYUAFILE?= ${ATFFILE} -.else -KYUAFILE= no -.endif - -# Additional list of 'tp' entries to add to the Atffile when ATFFILE=auto. -# These entries must all correspond to subdirectories to descend into. -# -# This is useful in the cases where the tests in a single directory come -# from various sources (e.g. src/tests and src/external/.../tests) and -# the installation of some of those tests rely on MK* variables being set. -ATFFILE_EXTRA_SUBDIRS?= - -.if ${ATFFILE:tl} != "no" -FILES+= Atffile -FILESDIR_Atffile= ${TESTSDIR} - -. if ${ATFFILE:tl} == "auto" -CLEANDIRFILES+= Atffile Atffile.tmp - -realall: Atffile -Atffile: Makefile - ${_MKTARGET_CREATE} - @{ echo 'Content-Type: application/X-atf-atffile; version="1"'; \ - echo; \ - echo '# Automatically generated by bsd.test.mk.'; \ - echo; \ - echo 'prop: test-suite = "NetBSD"'; \ - echo; \ - for tp in ${TESTS_SUBDIRS:N.WAIT} ${_TESTS} ${ATFFILE_EXTRA_SUBDIRS}; \ - do \ - echo "tp: $${tp}"; \ - done; } >Atffile.tmp - @mv Atffile.tmp Atffile -. endif -.endif - -.if ${KYUAFILE:tl} != "no" -FILES+= Kyuafile -FILESDIR_Kyuafile= ${TESTSDIR} - -. if ${KYUAFILE:tl} == "auto" -CLEANDIRFILES+= Kyuafile Kyuafile.tmp - -realall: Kyuafile -Kyuafile: Makefile - ${_MKTARGET_CREATE} - @{ \ - echo '-- Automatically generated by bsd.test.mk.'; \ - echo; \ - echo 'syntax(2)'; \ - echo; \ - echo 'test_suite("NetBSD")'; \ - if [ -n "${_TESTS}" ]; then \ - echo; \ - for tp in ${_TESTS}; do \ - echo "atf_test_program{name=\"$${tp}\"}"; \ - done; \ - fi; \ - if [ -n "${TESTS_SUBDIRS:N.WAIT}" -o \ - -n "${ATFFILE_EXTRA_SUBDIRS}" ]; then \ - echo; \ - for subdir in ${TESTS_SUBDIRS:N.WAIT} \ - ${ATFFILE_EXTRA_SUBDIRS}; do \ - echo "include(\"$${subdir}/Kyuafile\")"; \ - done; \ - fi; \ - } >Kyuafile.tmp - @mv Kyuafile.tmp Kyuafile -. endif -.endif - -.if ${ATFFILE:tl} != "no" || ${KYUAFILE:tl} != "no" -. include -.endif - -.if !empty(SCRIPTS) || !empty(PROGS) || !empty(PROGS_CXX) -. include -.endif - -# -# Definition of the "make test" target and supporting variables. -# -# This target, by necessity, can only work for native builds (i.e. a NetBSD -# host building a release for the same system). The target runs ATF, which is -# not in the toolchain, and the tests execute code built for the target host. -# -# Due to the dependencies of the binaries built by the source tree and how they -# are used by tests, it is highly possible for a execution of "make test" to -# report bogus results unless the new binaries are put in place. -# - -TESTS_PATH += ${DESTDIR}/bin ${DESTDIR}/sbin ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin -TESTS_LD_LIBRARY_PATH += ${DESTDIR}/lib ${DESTDIR}/usr/lib - -TESTS_ENV += ATF_BUILD_CC=${DESTDIR}/usr/bin/cc -TESTS_ENV += ATF_BUILD_CPP=${DESTDIR}/usr/bin/cpp -TESTS_ENV += ATF_BUILD_CXX=${DESTDIR}/usr/bin/c++ -TESTS_ENV += ATF_CONFDIR=${DESTDIR}/etc -TESTS_ENV += ATF_INCLUDEDIR=${DESTDIR}/usr/include -TESTS_ENV += ATF_LIBDIR=${DESTDIR}/usr/lib -TESTS_ENV += ATF_LIBEXECDIR=${DESTDIR}/usr/libexec -TESTS_ENV += ATF_PKGDATADIR=${DESTDIR}/usr/share/atf -TESTS_ENV += ATF_SHELL=${DESTDIR}/bin/sh -TESTS_ENV += LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:S/ /:/g} -TESTS_ENV += PATH=${TESTS_PATH:tW:S/ /:/g} - -_TESTS_FIFO = ${.OBJDIR}/atf-run.fifo -_TESTS_LOG = ${.OBJDIR}/atf-run.log -CLEANDIRFILES += ${_TESTS_FIFO} ${_TESTS_LOG} - -.PHONY: test -.if defined(TESTSDIR) -. if ${TESTSDIR} == ${TESTSBASE} -# Forbid this case. It is likely to cause false positives/negatives and it -# does not cover all the tests (e.g. it misses testing software in external). -test: - @echo "*** Sorry, you cannot use make test from src/tests. Install the" - @echo "*** tests into their final location and run them from /usr/tests" - @false -. else -test: - @echo "*** WARNING: make test is experimental" - @echo "***" - @echo "*** Using this test does not preclude you from running the tests" - @echo "*** installed in /usr/tests. This test run may raise false" - @echo "*** positives and/or false negatives." - @echo - @set -e; \ - cd ${DESTDIR}${TESTSDIR}; \ - rm -f ${_TESTS_FIFO}; \ - mkfifo ${_TESTS_FIFO}; \ - cat ${_TESTS_FIFO} | tee ${_TESTS_LOG} | \ - ${TESTS_ENV} ${DESTDIR}/usr/bin/atf-report & \ - result=0; \ - ${TESTS_ENV} ${DESTDIR}/usr/bin/atf-run >>${_TESTS_FIFO} || result=1; \ - wait; \ - rm -f ${_TESTS_FIFO}; \ - echo; \ - echo "*** The verbatim output of atf-run has been saved to ${_TESTS_LOG}"; \ - echo "*** Once again, note that "make test" is unsupported."; \ - test $${result} -eq 0 -. endif -.else -test: - @echo "*** No TESTSDIR defined; nothing to do." -.endif - -##### Pull in related .mk logic -.include diff --git a/src/share/mk/bsd.x11.mk b/src/share/mk/bsd.x11.mk deleted file mode 100644 index 92c5e2a..0000000 --- a/src/share/mk/bsd.x11.mk +++ /dev/null @@ -1,433 +0,0 @@ -# $NetBSD: bsd.x11.mk,v 1.117 2015/07/23 08:03:26 mrg Exp $ - -.include - -BINDIR= ${X11BINDIR} -LIBDIR= ${X11USRLIBDIR} -MANDIR= ${X11MANDIR} - -COPTS+= -fno-strict-aliasing - -.include - -.if defined(USE_SSP) && (${USE_SSP} != "no") -CPPFLAGS+= -DNO_ALLOCA -.endif - -X11FLAGS.VERSION= -DOSMAJORVERSION=5 -DOSMINORVERSION=99 # XXX - -# THREADS_DEFINES -# LSC (MINIX): Not supported: -D_REENTRANT-DXTHREADS -DXUSE_MTSAFE_API -X11FLAGS.THREADS= -DXNO_MTSAFE_PWDAPI - -# CONNECTION_FLAGS -# LSC (MINIX): Not supported: -DHAS_FCHOWN -X11FLAGS.CONNECTION= -DTCPCONN -DUNIXCONN -DHAS_STICKY_DIR_BIT \ - - -.if (${USE_INET6} != "no") -X11FLAGS.CONNECTION+= -DIPv6 -.endif - -# EXT_DEFINES -X11FLAGS.BASE_EXTENSION= -DMITMISC -DXTEST -DXTRAP -DXSYNC -DXCMISC \ - -DXRECORD -DMITSHM -DBIGREQS -DXF86VIDMODE \ - -DXF86MISC -DDPMSExtension -DEVI \ - -DSCREENSAVER -DXV -DXVMC -DGLXEXT \ - -DRES - -X11FLAGS.PERVASIVE_EXTENSION= -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP \ - -DXCSECURITY -DTOGCUP -DXF86BIGFONT \ - -DDPMSExtension -DPIXPRIV -DPANORAMIX \ - -DRENDER -DRANDR -DXFIXES -DDAMAGE \ - -DCOMPOSITE -DXEVIE -X11FLAGS.EXTENSION= ${X11FLAGS.BASE_EXTENSION} \ - ${X11FLAGS.PERVASIVE_EXTENSION} - -X11FLAGS.DIX= -DHAVE_DIX_CONFIG_H -D_BSD_SOURCE -DHAS_FCHOWN \ - -DHAS_STICKY_DIR_BIT -D_POSIX_THREAD_SAFE_FUNCTIONS \ - -DHAVE_XORG_CONFIG_H -X11INCS.DIX= -I${X11INCSDIR}/freetype2 \ - -I${X11INCSDIR}/pixman-1 \ - -I$(X11SRCDIR.xorg-server)/include \ - -I$(X11SRCDIR.xorg-server)/Xext \ - -I$(X11SRCDIR.xorg-server)/composite \ - -I$(X11SRCDIR.xorg-server)/damageext \ - -I$(X11SRCDIR.xorg-server)/xfixes \ - -I$(X11SRCDIR.xorg-server)/Xi \ - -I$(X11SRCDIR.xorg-server)/mi \ - -I$(X11SRCDIR.xorg-server)/miext/shadow \ - -I$(X11SRCDIR.xorg-server)/miext/damage \ - -I$(X11SRCDIR.xorg-server)/render \ - -I$(X11SRCDIR.xorg-server)/randr \ - -I$(X11SRCDIR.xorg-server)/fb \ - -I$(X11SRCDIR.xorg-server)/../include - -X11FLAGS.DRI= -DGLXEXT -DXF86DRI -DGLX_DIRECT_RENDERING \ - -DGLX_USE_DLOPEN -DGLX_USE_MESA - -.if ${X11DRI} != "no" -X11FLAGS.EXTENSION+= ${X11FLAGS.DRI} -.endif - -# ServerDefines -X11FLAGS.SERVER= -DSHAPE -DXKB -DLBX -DXAPPGROUP -DXCSECURITY \ - -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV \ - -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS \ - -DAVOID_GLYPHBLT -DSINGLEDEPTH -DXvExtension \ - -DXFree86Server -DXvMCExtension -DSMART_SCHEDULE \ - -DBUILDDEBUG -DXResExtension -DNDEBUG - -# OS_DEFINES -X11FLAGS.OS_DEFINES= -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR \ - -DDDXOSVERRORF -DDDXTIME -DUSB_HID - -.if defined(__MINIX) -X11FLAGS.OS_DEFINES+= -DXOS_USE_NO_LOCKING -.endif # defined(__MINIX) - -.if !(${MACHINE} == "acorn32" || \ - ${MACHINE} == "amiga" || \ - ${MACHINE} == "pmax" || \ - ${MACHINE} == "sun3" || \ - ${MACHINE} == "vax") -# EXT_DEFINES -X11FLAGS.EXTENSION+= -DXF86VIDMODE - -# ServerDefines -X11FLAGS.SERVER+= -DXINPUT -DXFreeXDGA -DXF86VIDMODE -.endif - -.if ${MACHINE_ARCH} == "alpha" || \ - ${MACHINE_ARCH} == "sparc64" || \ - ${MACHINE_ARCH} == "x86_64" -# ServerDefines -X11FLAGS.SERVER+= -D_XSERVER64 -X11FLAGS.EXTENSION+= -D__GLX_ALIGN64 -.endif - -.if ${MACHINE} == "amd64" || \ - ${MACHINE} == "cats" || \ - ${MACHINE} == "i386" || \ - ${MACHINE} == "macppc" || \ - ${MACHINE} == "netwinder" || \ - ${MACHINE} == "ofppc" || \ - ${MACHINE} == "prep" || \ - ${MACHINE} == "sgimips" || \ - ${MACHINE} == "sparc64" || \ - ${MACHINE} == "sparc" || \ - ${MACHINE} == "shark" || \ - ${MACHINE} == "zaurus" -# LOADABLE -X11FLAGS.LOADABLE= -DXFree86LOADER -DIN_MODULE -DXFree86Module \ - ${${ACTIVE_CXX} == "gcc":? -fno-merge-constants :} -.endif - -# XXX FIX ME -XVENDORNAMESHORT= '"X.Org"' -XVENDORNAME= '"The X.Org Foundation"' -XORG_RELEASE= '"Release 1.10.6"' -__XKBDEFRULES__= '"xorg"' -XLOCALE.DEFINES= -DXLOCALEDIR=\"${X11LIBDIR}/locale\" \ - -DXLOCALELIBDIR=\"${X11LIBDIR}/locale\" - -# XXX oh yeah, fix me later -XORG_VERSION_CURRENT="(((1) * 10000000) + ((10) * 100000) + ((6) * 1000) + 0)" - -PRINT_PACKAGE_VERSION= awk '/^PACKAGE_VERSION=/ { \ - match($$1, "([0-9]+\\.)+[0-9]+"); \ - version = substr($$1, RSTART, RLENGTH); \ - } END { print version }' - - -# Commandline to convert 'XCOMM' comments and 'XHASH' to '#', among other -# things. Transformed from the "CppSedMagic" macro from "Imake.rules". -# -X11TOOL_UNXCOMM= ${TOOL_SED} -e '/^\# *[0-9][0-9]* *.*$$/d' \ - -e '/^\#line *[0-9][0-9]* *.*$$/d' \ - -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ - -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ - -e '/^[ ]*XHASH/s/XHASH/\#/' \ - -e '/\@\@$$/s/\@\@$$/\\/' - - -CPPFLAGS+= -DCSRG_BASED -DFUNCPROTO=15 -DNARROWPROTO -CPPFLAGS+= -I${DESTDIR}${X11INCDIR} - -.if ${MACHINE_ARCH} == "x86_64" -CPPFLAGS+= -D__AMD64__ -.endif - -.if !defined(__MINIX) -LDFLAGS+= -Wl,-rpath,${X11USRLIBDIR} -L=${X11USRLIBDIR} -.else -LDFLAGS+= -Wl,-rpath,${X11USRLIBDIR} -L${DESTDIR}${X11USRLIBDIR} -.endif # !defined(__MINIX) - - -# -# .cpp -> "" handling -# CPPSCRIPTS list of files/scripts to run through cpp -# CPPSCRIPTFLAGS extra flags to ${CPP} -# CPPSCRIPTFLAGS_fn extra flags to ${CPP} for file `fn' -# -.if defined(CPPSCRIPTS) # { -.SUFFIXES: .cpp - -.cpp: - ${_MKTARGET_CREATE} - rm -f ${.TARGET} - ${CC} -E -undef -traditional - \ - ${CPPSCRIPTFLAGS_${.TARGET}:U${CPPSCRIPTFLAGS}} \ - < ${.IMPSRC} | ${X11TOOL_UNXCOMM} > ${.TARGET} - -realall: ${CPPSCRIPTS} - -CLEANFILES+= ${CPPSCRIPTS} -.endif # } - -# -# X.Org pkgconfig files handling -# -# PKGCONFIG is expected to contain a list of pkgconfig module names. -# They will produce the files .pc, .pc, etc, to be -# put in X11USRLIBDIR/pkgconfig. -# -# PKGDIST contains the name of a X11SRCDIR subscript where to find the -# source file for the pkgconfig files. -# -# If PKGDIST is not suitable, a consumer can set PKGDIST. with -# the full path to the source file. -# -# Also, the consumer can use PKGDIST alone, and a PKGCONFIG will be -# derived from it. Many times, PKGDIST is capitalized and PKGCONFIG is -# the lower case version. -# - -.if defined(PKGDIST) && !defined(PKGCONFIG) -PKGCONFIG= ${PKGDIST:tl} -.endif -.if defined(PKGCONFIG) && !defined(MLIBDIR) - -.include - -_PKGCONFIG_FILES= ${PKGCONFIG:C/$/.pc/} - -.PHONY: pkgconfig-install -pkgconfig-install: - -realall: ${_PKGCONFIG_FILES:O:u} -realinstall: pkgconfig-install - -.for _pkg in ${PKGCONFIG:O:u} # { - -PKGDIST.${_pkg}?= ${X11SRCDIR.${PKGDIST:U${_pkg}}} -_PKGDEST.${_pkg}= ${DESTDIR}${X11USRLIBDIR}/pkgconfig/${_pkg}.pc - -.PATH: ${PKGDIST.${_pkg}} - -FILESOWN_${_pkg}.pc= ${BINOWN} -FILESGRP_${_pkg}.pc= ${BINGRP} -FILESMODE_${_pkg}.pc= ${NONBINMODE} - -${_PKGDEST.${_pkg}}: ${_pkg}.pc __fileinstall -pkgconfig-install: ${_PKGDEST.${_pkg}} - -# Add a dependancy on the configure file if it exists; this way we -# will rebuild the .pc file if the version in configure changes. -.if exists(${PKGDIST.${_pkg}}/configure) -${_pkg}.pc: ${PKGDIST.${_pkg}}/configure Makefile -.endif - -.endfor # } - -# XXX -# The sed script is very, very ugly. What we actually need is a -# mknative-xorg script that will generate all the .pc files from -# running the autoconfigure script. -# And yes, it has to be split in multiple parts otherwise it's -# too long for sed to handle. - -# hacky transforms: -# @XCBPROTO_VERSION@ - -.SUFFIXES: .pc.in .pc -.pc.in.pc: - ${_MKTARGET_CREATE} - rm -f ${.TARGET} - if [ -n '${PKGCONFIG_VERSION.${.PREFIX}}' ]; then \ - _pkg_version='${PKGCONFIG_VERSION.${.PREFIX}}'; \ - else \ - _pkg_version=$$(${PRINT_PACKAGE_VERSION} \ - ${PKGDIST.${.PREFIX}}/configure); \ - fi; \ - ${TOOL_SED} \ - ${PKGCONFIG_SED_FLAGS} \ - -e "s,@prefix@,${X11ROOTDIR},; \ - s,@INSTALL_DIR@,${X11ROOTDIR},; \ - s,@exec_prefix@,\\$$\{prefix\},; \ - s,@libdir@,\\$$\{prefix\}/lib,; \ - s,@includedir@,\\$$\{prefix\}/include,; \ - s,@datarootdir@,\\$$\{prefix\}/share,; \ - s,@datadir@,\\$$\{datarootdir\},; \ - s,@appdefaultdir@,\\$$\{libdir}/X11/app-defaults,; \ - s,@MAPDIR@,\\$$\{libdir\}/X11/fonts/util,; \ - s,@ICONDIR@,\\$$\{datarootdir\}/icons,; \ - s,@PACKAGE_VERSION@,$${_pkg_version},; \ - s,@VERSION@,$${_pkg_version},; \ - s,@COMPOSITEEXT_VERSION@,$${_pkg_version%.*},; \ - s,@DAMAGEEXT_VERSION@,$${_pkg_version%.*},; \ - s,@FIXESEXT_VERSION@,$${_pkg_version%.*},; \ - s,@RANDR_VERSION@,$${_pkg_version%.*},; \ - s,@RENDER_VERSION@,$${_pkg_version%.*}," \ - -e "s,@LIBS@,,; \ - s,@Z_LIBS@,-lz,; \ - s,@LIBZ@,-lz,; \ - s,@LIBBZ2@,-lbz2,; \ - s,@xkb_base@,\\$$\{prefix\}/lib/X11/xkb,; \ - s,@xcbincludedir@,\\$$\{prefix\}/share/xcb,; \ - s,@fontrootdir@,\\$$\{libdir\}/X11/fonts,; \ - s,@LIBXML2_LIBS@,,; \ - s,@LIBXML2_CFLAGS@,,; \ - s,@ICONV_CFLAGS@,,; \ - s,@ICONV_LIBS@,,; \ - s,@NEEDED@,,; \ - s,@FT2_EXTRA_LIBS@,," \ - -e "s,@moduledir@,\\$$\{libdir\}/modules,; \ - s,@sdkdir@,\\$$\{includedir\}/xorg,; \ - s,@PIXMAN_CFLAGS@,,; \ - s,@LIB_DIR@,/lib,; \ - s,@INSTALL_LIB_DIR@,\\$$\{prefix\}/lib,; \ - s,@INSTALL_INC_DIR@,\\$$\{prefix\}/include,; \ - s,@XKBPROTO_REQUIRES@,kbproto,; \ - s,@XCBPROTO_VERSION@,1.7,; \ - s,@FREETYPE_REQUIRES@,freetype2,; \ - s,@EXPAT_LIBS@,-lexpat,; \ - s,@FREETYPE_LIBS@,-lfreetype,; \ - s,@DEP_CFLAGS@,,; \ - s,@DEP_LIBS@,,; \ - s,@X11_EXTRA_DEPS@,,; \ - s,@XTHREAD_CFLAGS@,-D_REENTRANT,; \ - s,@XTHREADLIB@,-lpthread,; \ - s,@GL_LIB@,GL,; \ - s,@GL_PC_REQ_PRIV@,x11 xext,; \ - s,@GL_PC_LIB_PRIV@,-lm -lpthread,; \ - s,@GL_PC_CFLAGS@,,; \ - s,@GLX_TLS@,no," \ - -e "s,@GLU_LIB@,GLU,; \ - s,@GLU_PC_REQ@,gl,; \ - s,@GLU_PC_REQ_PRIV@,,; \ - s,@GLU_PC_LIB_PRIV@,-lGLU,; \ - s,@GLU_PC_CFLAGS@,,; \ - s,@GLUT_LIB@,glut,; \ - s,@GLUT_PC_REQ_PRIV@,gl glu,; \ - s,@GLUT_PC_LIB_PRIV@,-lglut,; \ - s,@GLUT_PC_CFLAGS@,,; \ - s,@GLW_PC_CFLAGS@,,; \ - s,@GLW_PC_REQ_PRIV@,x11 xt,; \ - s,@GLW_PC_LIB_PRIV@,,; \ - s,@DRI_DRIVER_DIR@,\\$$\{libdir\}/modules/dri,; \ - s,@DRI_PC_REQ_PRIV@,,; \ - s,@GLW_LIB@,GLw,; \ - s,@GBM_PC_REQ_PRIV@,,; \ - s,@GBM_PC_LIB_PRIV@,,; \ - s,@abi_ansic@,0.4,; \ - s,@abi_videodrv@,5.0,; \ - s,@abi_xinput@,4.0,; \ - s,@abi_extension@,2.0,; \ - s,@abi_font@,0.6,; \ - s,@fchown_define@,-DHAS_FCHOWN,; \ - s,@sticky_bit_define@,-DHAS_STICKY_DIR_BIT,;" \ - -e "s,@PKG_CONFIG_LIBS@,${PKG_CONFIG_LIBS},; \ - s,@PACKAGE@,${PKGDIST},; \ - s,@PKGCONFIG_REQUIRES@,${PKGCONFIG_REQUIRES},; \ - s,@PKGCONFIG_REQUIRES_PRIVATELY@,${PKGCONFIG_REQUIRES_PRIVATELY},; \ - s,@ERRORDBDIR@,${X11LIBDIR},; \ - s,@EXPAT_CFLAGS@,,; \ - s,@FREETYPE_CFLAGS@,-I${X11ROOTDIR}/include/freetype2 -I${X11ROOTDIR}/include,;" \ - -e '/^Libs:/ s%-L\([^ ]*\)%-Wl,-rpath,\1 &%g' \ - < ${.IMPSRC} > ${.TARGET}.tmp && \ - mv -f ${.TARGET}.tmp ${.TARGET} - -CLEANFILES+= ${_PKGCONFIG_FILES} ${_PKGCONFIG_FILES:C/$/.tmp/} -.endif - -# -# APPDEFS (app defaults) handling -# -.if defined(APPDEFS) # { -appdefsinstall:: .PHONY ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@} -.PRECIOUS: ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@} - -__appdefinstall: .USE - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \ - ${.ALLSRC} ${.TARGET} - -.for S in ${APPDEFS:O:u} -${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}: ${S} __appdefinstall -.endfor - -realinstall: appdefsinstall -.endif # } - - -# -# .man page handling -# -.if (${MKMAN} != "no" && (${MAN:U} != "" || ${PROG:U} != "")) # { -CLEANDIRFILES+= ${MAN:U${PROG:D${PROG.1}}} -.endif # } - -.SUFFIXES: .man .man.pre .1 .3 .4 .5 .7 - -_X11MANTRANSFORM= \ - __adminmansuffix__ 8 \ - __apploaddir__ ${X11ROOTDIR}/lib/X11/app-defaults \ - __appmansuffix__ 1 \ - __bindir__ ${X11BINDIR} \ - __drivermansuffix__ 4 \ - __filemansuffix__ 5 \ - __LIB_MAN_SUFFIX__ 3 \ - __libmansuffix__ 3 \ - __logdir__ /var/log \ - __mandir__ ${X11MANDIR} \ - __miscmansuffix__ 7 \ - __oslibmansuffix__ 3 \ - __projectroot__ ${X11ROOTDIR} \ - ${X11EXTRAMANTRANSFORMS} - -# Note the escaping trick for _X11MANTRANSFORM using % to replace spaces -XORGVERSION= '"X Version 11"' -X11MANCPP?= no -_X11MANTRANSFORM+= \ - __vendorversion__ ${XORGVERSION:C/ /%/gW} \ - __XCONFIGFILE__ xorg.conf \ - __xconfigfile__ xorg.conf \ - __XCONFIGFILEMAN__ '__XCONFIGFILE__%(__filemansuffix__)' \ - __xorgversion__ ${XORGVERSION:C/ /%/gW} \ - __XSERVERNAME__ Xorg \ - __xservername__ Xorg - -_X11MANTRANSFORMCMD= ${TOOL_SED} -e 's/\\$$/\\ /' ${.IMPSRC} - -.if ${X11MANCPP} != "no" -_X11MANTRANSFORMCMD+= | ${CC} -E -undef -traditional - -. for __def__ __value__ in ${_X11MANTRANSFORM} -_X11MANTRANSFORMCMD+= -D${__def__}=${__value__:C/%/ /gW} -. endfor -.else -_X11MANTRANSFORMCMD+= | ${TOOL_SED} -. for __def__ __value__ in ${_X11MANTRANSFORM} -_X11MANTRANSFORMCMD+= -e s,${__def__},${__value__:C/%/ /gW},g -. endfor -.endif -_X11MANTRANSFORMCMD+= ${X11EXTRAMANDEFS} - -.man.1 .man.3 .man.4 .man.5 .man.7 .man.pre.1 .man.pre.4 .man.pre.5: - ${_MKTARGET_CREATE} - rm -f ${.TARGET} - ${_X11MANTRANSFORMCMD} | ${X11TOOL_UNXCOMM} > ${.TARGET} - -##### Pull in related .mk logic -.include diff --git a/src/share/mk/minix.gcov.mk b/src/share/mk/minix.gcov.mk deleted file mode 100644 index 42ae988..0000000 --- a/src/share/mk/minix.gcov.mk +++ /dev/null @@ -1,51 +0,0 @@ -LCOV=lcov.$(PROG) -CLEANFILES+= *.gcno *.gcda $(LCOV) - -# Right now we support obtaining coverage information for system services only, -# and for their main program code (not including their libraries) only. -# -# Why not userland as well: because we do not care as much, and it should be -# possible to produce coverage information for system services without -# recompiling the entire system with coverage support. Moreover, as of writing -# we do not have libprofile_rt, making it impossible to compile regular -# programs with coverage support altogether. -# -# Why not system service libraries (eg libsys) as well: practical concerns.. -# 1) As of writing, even for such libraries we make a regular and a PIC -# version, both producing a .gcno file for each object. The PIC version is -# compiled last, while the regular version is used for the library archive. -# The result is a potential mismatch between the compile-time coverage -# metadata and the run-time coverage counts. -# 2) The kernel has no coverage support, and with its self-relocation it would -# be tricky to add support for it. As a result, libraries used by the -# kernel would have to be excluded from being compiled with coverage support -# so as not to create problems. One could argue that that is a good thing -# because eg libminc and libsys create too many small result units (see also -# the current hardcoded limit in libsys/llvm_gcov.c). -# 3) gcov-pull(8) strips paths, which results in lots of manual work to figure -# out what file belongs to which library, even ignoring object name -# conflicts, for example between libraries. -# 4) In order to produce practically useful results ("how much of libsockevent -# is covered by the combination of LWIP and UDS" etc), gcov-pull(8) would -# have to be extended with support for merging .gcda files. The standard -# LLVM libprofile_rt implementation supports this, but we do not. -# All of these issues are solvable, but for now anyone interested in coverage -# for a particular system service library will have to mess with individual -# makefiles themselves. - -.if ${MKCOVERAGE:Uno} == "yes" -.if ${ACTIVE_CC} == "gcc" -# Leftovers for GCC. It is not clear whether these still work at all. -COVCPPFLAGS?= -fno-builtin -fprofile-arcs -ftest-coverage -COVLDADD?= -lgcov -.else # ${ACTIVE_CC} != "gcc" -# We assume LLVM/clang here. For other compilers this will likely break the -# MKCOVERAGE compilation, which is a good indication that support for them -# should be added here. -COVCPPFLAGS?= --coverage -g -O0 -COVLDADD?= -.endif # ${ACTIVE_CC} != "gcc" -.endif # ${MKCOVERAGE:Uno} == "yes" - -lcov: - lcov -c -d . >$(LCOV) diff --git a/src/share/mk/minix.service.mk b/src/share/mk/minix.service.mk deleted file mode 100644 index daf7f15..0000000 --- a/src/share/mk/minix.service.mk +++ /dev/null @@ -1,102 +0,0 @@ -# MINIX-specific servers/drivers options -.include - -# LSC: Our minimal c library has no putchar, which is called by the builtin -# functions of the compiler, so prevent using them. - -AFLAGS+= -D__ASSEMBLY__ -COPTS+= -fno-builtin - -# For MKCOVERAGE builds, enable coverage options. -.if ${MKCOVERAGE:Uno} == "yes" -CPPFLAGS+= ${COVCPPFLAGS} -LDADD+= ${COVLDADD} -.endif # ${MKCOVERAGE:Uno} == "yes" - -# LSC Static linking, order matters! -# We can't use --start-group/--end-group as they are not supported by our -# version of clang. - -# 1. No default libs -LDADD:= -nodefaultlibs ${LDADD} - -# 2. Services system library -LDADD+= -lsys -DPADD+= ${LIBSYS} - -# 3. Minimal C library, if libc had not yet been added -.if ${LDADD:M-lc} == "" -LDADD+= -lminc -DPADD+= ${LIBMINC} -.endif # empty(${LDADD:M-lc}) - -.if ${MACHINE_ARCH} == "earm" - -# LSC: On ARM, when compiling statically, with gcc, lgcc_eh is required -.if ${PROG:U} != "kernel" && !empty(CC:M*gcc) -# gcc_eh uses abort(), which is provided by minc -LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:} -.endif # ${PROG:U} != "kernel" && !empty(CC:M*gcc) - -.endif # ${MACHINE_ARCH} == "earm" - -# Get (more) internal minix definitions and declarations. -CPPFLAGS += -D_MINIX_SYSTEM=1 - -# For MKMAGIC builds, link services against libmagicrt and run the magic pass -# on them, unless they have specifically requested to be built without bitcode. -.if ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes" -LIBMAGICST?= ${DESTDIR}${LIBDIR}/libmagicrt.bcc -MAGICPASS?= ${NETBSDSRCDIR}/minix/llvm/bin/magic.so - -DPADD+= ${LIBMAGICST} ${MAGICPASS} - -.for _P in ${PROGS:U${PROG}} -BITCODE_LD_FLAGS_1ST.${_P}?= ${LIBMAGICST} -.endfor - -MAGICFLAGS?= -OPTFLAGS+= -load ${MAGICPASS} -magic ${MAGICFLAGS} - -# For MKASR builds, generate an additional set of rerandomized service -# binaries. -.if ${USE_ASR:Uno} == "yes" -ASRPASS?= ${NETBSDSRCDIR}/minix/llvm/bin/asr.so -ASRCOUNT?= 3 -ASRDIR?= /usr/service/asr - -DPADD+= ${ASRPASS} - -OPTFLAGS+= -load ${ASRPASS} -asr - -# Produce a variable _RANGE that contains "1 2 3 .. ${ASRCOUNT}". We do not -# want to invoke a shell command to do this; what if the host platform does not -# have seq(1) ? So, we do it with built-in BSD make features instead. There -# are probably substantially better ways to do this, though. Right now the -# maximum ASRCOUNT is 65536 (16**4), which should be plenty. An ASRCOUNT of 0 -# is not supported, nor would it be very useful. -_RANGE= 0 -_G0= xxxxxxxxxxxxxxxx -_G= ${_G0:S/x/${_G0}/g:S/x/${_G0}/g:S/x/${_G0}/g} -.for _X in ${_G:C/^(.{${ASRCOUNT}}).*/\1/:S/x/x /g} -_RANGE:= ${_RANGE} ${_RANGE:[#]} -.endfor -_RANGE:= ${_RANGE:[2..-1]} - -# Add progname-1, progname-2, progname-3 (etc) to the list of programs to -# generate, and install (just) these to ASRDIR. -PROGS?= ${PROG} -_PROGLIST:= ${PROGS} -.for _N in ${_RANGE} -.for _P in ${_PROGLIST} -PROGS+= ${_P}-${_N} -SRCS.${_P}-${_N}= ${SRCS.${_P}:U${SRCS}} -BITCODE_LD_FLAGS_1ST.${_P}-${_N}:= ${BITCODE_LD_FLAGS_1ST.${_P}} -BINDIR.${_P}-${_N}= ${ASRDIR} -.endfor -.endfor - -.endif # ${USE_ASR:Uno} == "yes" -.endif # ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes" - -.include diff --git a/src/share/mk/ubix.dep.mk b/src/share/mk/ubix.dep.mk new file mode 100644 index 0000000..c6cb500 --- /dev/null +++ b/src/share/mk/ubix.dep.mk @@ -0,0 +1,142 @@ +# $NetBSD: bsd.dep.mk,v 1.82 2014/12/01 01:34:30 erh Exp $ + +.if defined(__MINIX) +#LSC: Be a bit smarter about the default compiler +.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) +CC?= clang +.endif + +.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) +CC?= gcc +.endif + +MKDEP?= CC=${CC:Q} mkdep +MKDEPCXX?= CC=${CXX:Q} mkdep +.endif # defined(__MINIX) + +##### Basic targets +realdepend: beforedepend .depend afterdepend +.ORDER: beforedepend .depend afterdepend + +beforedepend .depend afterdepend: # ensure existence + +##### Default values +MKDEP?= mkdep +MKDEPCXX?= mkdep +MKDEP_SUFFIXES?= .o .d + +##### Build rules +# some of the rules involve .h sources, so remove them from mkdep line + +.if defined(SRCS) && !empty(SRCS) +__acpp_flags= ${_ASM_TRADITIONAL_CPP} + +.if defined(NODPSRCS) +.for f in ${SRCS} ${DPSRCS} +.if "${NODPSRCS:M${f}}" == "" +__DPSRCS.all+= ${f:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} +.endif +.endfor +beforedepend: ${DPSRCS} +.else +__DPSRCS.all+= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \ + ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} +.endif +__DPSRCS.d= ${__DPSRCS.all:O:u:M*.d} +__DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d} + +.if defined(__MINIX) +__DPSRCS.bcd= ${"${USE_BITCODE:Uno}" == "yes":? ${SRCS:M*.c:O:u:.c=.bcd}:} +__DPSRCS.d+= ${__DPSRCS.bcd} +.endif # defined(__MINIX) + +.NOPATH: .depend ${__DPSRCS.d} + +.if !empty(__DPSRCS.d) # { +${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS} +.endif # } + +MKDEPSUFFLAGS=-s ${MKDEP_SUFFIXES:Q} + +.if defined(MKDEPINCLUDES) && ${MKDEPINCLUDES} != "no" +.STALE: + @echo Rebuilding dependency file: ${.ALLSRC} + @rm -f ${.ALLSRC} + @(cd ${.CURDIR} && ${MAKE} depend) +_MKDEP_MERGEFLAGS=-i +_MKDEP_FILEFLAGS=${MKDEPSUFFLAGS} +.else +_MKDEP_MERGEFLAGS=${MKDEPSUFFLAGS} +_MKDEP_FILEFLAGS= +.endif + +.depend: ${__DPSRCS.d} + ${_MKTARGET_CREATE} + rm -f .depend + ${MKDEP} ${_MKDEP_MERGEFLAGS} -d -f ${.TARGET} ${__DPSRCS.d} + +.if !defined(__MINIX) +.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m +.else +.SUFFIXES: .bcd .d .s .S .c .C .cc .cpp .cxx .m + +.if ${USE_BITCODE:Uno} == "yes" +.c.bcd: + ${_MKTARGET_CREATE} + ${MKDEP} -f ${.TARGET} -s .bc -- ${MKDEPFLAGS} \ + ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} +.endif # ${USE_BITCODE:Uno} == "yes" +.endif # !defined(__MINIX) + +.c.d: + ${_MKTARGET_CREATE} + ${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ + ${CFLAGS:M-std=*} ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \ + mv ${.TARGET}.tmp ${.TARGET} + +.m.d: + ${_MKTARGET_CREATE} + ${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ + ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \ + mv ${.TARGET}.tmp ${.TARGET} + +.s.d .S.d: + ${_MKTARGET_CREATE} + ${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ + ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${AFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} \ + ${__acpp_flags} ${.IMPSRC} && \ + mv ${.TARGET}.tmp ${.TARGET} + +.C.d .cc.d .cpp.d .cxx.d: + ${_MKTARGET_CREATE} + ${MKDEPCXX} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ + ${CXXFLAGS:M-std=*} ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \ + mv ${.TARGET}.tmp ${.TARGET} + +.endif # defined(SRCS) && !empty(SRCS) # } + +##### Clean rules +.if defined(SRCS) && !empty(SRCS) +CLEANDIRFILES+= .depend ${__DPSRCS.d} ${__DPSRCS.d:.d=.d.tmp} ${.CURDIR}/tags ${CLEANDEPEND} +.endif + +##### Custom rules +.if !target(tags) +tags: ${SRCS} +.if defined(SRCS) && !empty(SRCS) + ${_MKTARGET_CREATE} + -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ + ${TOOL_SED} "s;\${.CURDIR}/;;" > tags +.endif +.endif + +##### Pull in related .mk logic +.include diff --git a/src/share/mk/ubix.doc.mk b/src/share/mk/ubix.doc.mk new file mode 100644 index 0000000..ef3e49f --- /dev/null +++ b/src/share/mk/ubix.doc.mk @@ -0,0 +1,219 @@ +# $NetBSD: bsd.doc.mk,v 1.68 2015/08/04 08:36:14 dholland Exp $ +# @(#)bsd.doc.mk 8.1 (Berkeley) 8/14/93 + +.include + +# The makefile should set these: +# SECTION one of usd, smm, or psd (lower-case) +# ARTICLE name of this document +# SRCS roff source files +# DEPSRCS additional roff source files implicitly included +# MACROS name(s) of roff macro packages, including the -m +# ROFF_PIC set to "yes" to use pic(1) +# ROFF_EQN set to "yes" to use eqn(1) +# ROFF_TBL set to "yes" to use tbl(1) +# ROFF_REFER set to "yes" to use refer(1) +# EXTRAHTMLFILES additional files emitted as part of HTML build +# +# PAGES unknown (XXX) +# EXTRA extra files to install (XXX) +# +# If there are multiple docs to be generated, set these: +# SUBARTICLES= name1 name2 ... +# SRCS.name1= roff source files +# SRCS.name2= more roff source files +# SRCS. : = : +# DEPSRCS.name1= additional included roff source files +# DEPSRCS.name2= more additional included roff source files +# DEPSRCS. : = : +# +# I'm hoping that MACROS and ROFF_* can be uniform across all +# subarticles. + + +# Old bsd.doc.mk files tend to invoke tbl and other preprocessors +# directly; they should be changed to set ROFF_* instead. +# +# Also they set e.g. DIR=usd/72.mydocument; this should be changed +# to SECTION=usd and ARTICLE=mydocument. The article numbers are +# no longer present in the file system and do not need to be known +# at build time. +# + +# 20130908 dholland: Make sure all makefiles have been converted to the +# new scheme. +.if !defined(SECTION) +.error "bsd.doc.mk: SECTION must be defined" +.endif +.if target(paper.ps) +.error "bsd.doc.mk: target(paper.ps) is true -- this is not allowed" +.endif + +# 20130908 dholland: right now we cannot generate pdf from roff sources, +# so build compressed postscript instead. XXX. (and: yech) +TOOL_ROFF_PDF?=false "No roff pdf support" +PRINTABLE=ps.gz +#PRINTABLE=ps +#PRINTABLE=pdf + +# If there aren't subarticles, we generate one doc that has the same +# name as the top-level article. +SUBARTICLES?=${ARTICLE} +SRCS.${ARTICLE}?=${SRCS} +DEPSRCS.${ARTICLE}?=${DEPSRCS} + +##### Build + +.for SA in ${SUBARTICLES} +.if ${MKDOC} != "no" +realall: ${SA}.txt +realall: ${SA}.${PRINTABLE} +.if ${MKHTML} != "no" && ${MKGROFFHTMLDOC} != "no" +realall: ${SA}.html +.endif +.endif +.endfor # SUBARTICLES + +.if defined(ROFF_PIC) && ${ROFF_PIC} != "no" +ROFFFLAGS+=-p +.endif +.if defined(ROFF_EQN) && ${ROFF_EQN} != "no" +ROFFFLAGS+=-e +.endif +.if defined(ROFF_TBL) && ${ROFF_TBL} != "no" +ROFFFLAGS+=-t +.endif +.if defined(ROFF_REFER) && ${ROFF_REFER} != "no" +ROFFFLAGS+=-R +.endif +ROFFFLAGS+=-I${.CURDIR} + +.for SA in ${SUBARTICLES} + +# +# Find the sources. +# +# We can't use .IMPSRC in the rules because they aren't suffix rules +# (they could be for some docs, but not others) and we can't use +# .ALLSRC because that includes DEPSRCS. +# +# As far as I know, the only ways to get the path discovered via .PATH +# are those two magic variables or the P modifier. +# +# For some reason the P modifier finds the path to a variable name, +# not the path to a word in a variable. +# + +.for S in ${SRCS.${SA}} +SRCS2.${SA}+=${${S}:P} +.endfor +.for S in ${DEPSRCS.${SA}} +DEPSRCS2.${SA}+=${${S}:P} +.endfor + +# +# Note: we use TOOL_ROFF_DOCASCII because TOOL_ROFF_ASCII invokes +# the nroff wrapper instead of groff directly, and that doesn't +# understand -I. +# +# We use TOOL_ROFF_DOCHTML because TOOL_ROFF_HTML uses -mdoc2html, +# which is great if it works but doesn't work with at least some of +# the non-mdoc docs. (e.g. the curses one) TOOL_ROFF_DOCHTML uses +# groff -Thtml, which produces fairly blah output but works with these +# docs. It might end up being necessary to choose one or the other on +# a per-document basis... sigh. +# + +${SA}.txt: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} + ${_MKTARGET_FORMAT} + ${TOOL_ROFF_DOCASCII} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ + > ${.TARGET} + +${SA}.ps: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} + ${_MKTARGET_FORMAT} + ${TOOL_ROFF_PS} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ + | ${TOOL_SED} -e '/^%%CreationDate:/d' \ + > ${.TARGET} + +${SA}.pdf: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} + ${_MKTARGET_FORMAT} + ${TOOL_ROFF_PDF} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ + > ${.TARGET} + +${SA}.html: ${SRCS2.${SA}} ${DEPSRCS2.${SA}} + ${_MKTARGET_FORMAT} + ${TOOL_ROFF_DOCHTML} ${ROFFFLAGS} ${MACROS} ${PAGES} ${SRCS2.${SA}} \ + -P -I -P ${SA} \ + > ${.TARGET} + +${SA}.ps.gz: ${SA}.ps + ${TOOL_GZIP} -9 -c -n ${.ALLSRC} > ${.TARGET} + +.endfor # SUBARTICLES + +##### Install + +DOCINST:= +.for SA in ${SUBARTICLES} +DOCINST+=${SA}.txt ${SA}.${PRINTABLE} +.if ${MKHTML} != "no" && ${MKGROFFHTMLDOC} != "no" +DOCINST+=${SA}.html +.endif +.endfor +.if ${MKHTML} != "no" && ${MKGROFFHTMLDOC} != "no" +DOCINST+=${EXTRAHTMLFILES} +.endif + +.if ${MKDOC} != "no" +docinstall: +.for D in ${DOCINST} + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE} ${D} \ + ${DESTDIR}${DOCDIR}/${SECTION}/${ARTICLE}/${D} +.endfor +.else +docinstall: ; +.endif + +.PHONY: docinstall +realinstall: docinstall + +##### Clean + +cleandoc: +.for SA in ${SUBARTICLES} + rm -f ${SA}.txt ${SA}.ps ${SA}.ps.gz ${SA}.html +.endfor + rm -f ${EXTRAHTMLFILES} [eE]rrs mklog ${CLEANFILES} + +.PHONY: cleandoc +clean: cleandoc + +##### Extra custom rules + +.if !target(print) +print: ; +.PHONY: print +.for SA in ${SUBARTICLES} +print: print.${SA} +.PHONY: print.{SA} +print.${SA}: ${SA}.ps + lpr -P${PRINTER} ${.ALLSRC} +.endfor +.endif + +spell: ; +.PHONY: spell +.for SA in ${SUBARTICLES} +spell: spell.${SA} +.PHONY: spell.{SA} +spell.${SA}: ${SRCS2} ${DEPSRCS2} + spell ${SRCS2} | sort | comm -23 - spell.ok > paper.spell +.endfor + +##### Pull in related .mk logic + +.include +.include + +${TARGETS}: # ensure existence diff --git a/src/share/mk/ubix.endian.mk b/src/share/mk/ubix.endian.mk new file mode 100644 index 0000000..45ebf7c --- /dev/null +++ b/src/share/mk/ubix.endian.mk @@ -0,0 +1,33 @@ +# $NetBSD: bsd.endian.mk,v 1.22 2014/09/19 17:45:42 matt Exp $ + +.if !defined(_BSD_ENDIAN_MK_) +_BSD_ENDIAN_MK_=1 + +.include + +.if ${MACHINE_ARCH} == "aarch64" || \ + ${MACHINE_ARCH} == "alpha" || \ + ${MACHINE_ARCH} == "arm" || \ + (!empty(MACHINE_ARCH:Mearm*) && empty(MACHINE_ARCH:Mearm*eb)) || \ + ${MACHINE_ARCH} == "i386" || \ + ${MACHINE_ARCH} == "ia64" || \ + ${MACHINE_ARCH} == "vax" || \ + ${MACHINE_ARCH} == "riscv32" || \ + ${MACHINE_ARCH} == "riscv64" || \ + ${MACHINE_ARCH} == "x86_64" || \ + ${MACHINE_ARCH:C/^.*el$/el/} == "el" +TARGET_ENDIANNESS= 1234 +.elif ${MACHINE_ARCH} == "coldfire" || \ + ${MACHINE_ARCH} == "hppa" || \ + ${MACHINE_ARCH} == "m68000" || \ + ${MACHINE_ARCH} == "m68k" || \ + ${MACHINE_ARCH} == "or1k" || \ + ${MACHINE_ARCH} == "powerpc" || \ + ${MACHINE_ARCH} == "powerpc64" || \ + ${MACHINE_ARCH} == "sparc" || \ + ${MACHINE_ARCH} == "sparc64" || \ + ${MACHINE_ARCH:C/^.*eb$/eb/} == "eb" +TARGET_ENDIANNESS= 4321 +.endif + +.endif # !defined(_BSD_ENDIAN_MK_) diff --git a/src/share/mk/ubix.files.mk b/src/share/mk/ubix.files.mk new file mode 100644 index 0000000..4a1df65 --- /dev/null +++ b/src/share/mk/ubix.files.mk @@ -0,0 +1,162 @@ +# $NetBSD: bsd.files.mk,v 1.43 2013/04/06 15:39:19 uebayasi Exp $ + +.if !defined(_BSD_FILES_MK_) +_BSD_FILES_MK_=1 + +.include + +.if !target(__fileinstall) +##### Basic targets +realinstall: filesinstall +realall: filesbuild + +##### Default values +FILESDIR?= ${BINDIR} +FILESOWN?= ${BINOWN} +FILESGRP?= ${BINGRP} +FILESMODE?= ${NONBINMODE} + +##### Build rules +filesbuild: +.PHONY: filesbuild + +##### Install rules +filesinstall:: # ensure existence +.PHONY: filesinstall + +configfilesinstall:: .PHONY + +__fileinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} \ + -o ${FILESOWN_${.ALLSRC:T}:U${FILESOWN}} \ + -g ${FILESGRP_${.ALLSRC:T}:U${FILESGRP}} \ + -m ${FILESMODE_${.ALLSRC:T}:U${FILESMODE}} \ + ${SYSPKGTAG} ${.ALLSRC} ${.TARGET} + +.endif # !target(__fileinstall) + + +.for F in ${FILES:O:u} +_FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override +_FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override +_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path +_FDOBUILD:= ${FILESBUILD_${F}:U${FILESBUILD:Uno}} + +.if ${MKUPDATE} == "no" +${_F}! ${F} __fileinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __fileinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") +${_F}: .MADE # no build at install +.endif +.endif + +.if ${_FDOBUILD} != "no" +filesbuild: ${F} +CLEANFILES+= ${F} +.endif + +filesinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + + +# +# CONFIGFILES +# +configinstall: configfilesinstall + +.for F in ${CONFIGFILES:O:u} +_FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override +_FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override +_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path +_FDOBUILD:= ${FILESBUILD_${F}:U${FILESBUILD:Uno}} + +.if ${MKUPDATE} == "no" +${_F}! ${F} __fileinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __fileinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no") +${_F}: .MADE # no build at install +.endif +.endif + +.if ${_FDOBUILD} != "no" +filesbuild: ${F} +CLEANFILES+= ${F} +.endif + +configfilesinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _FDIR +.undef _FNAME +.undef _F + + +# +# BUILDSYMLINKS +# +.if defined(BUILDSYMLINKS) # { + +.for _SL _TL in ${BUILDSYMLINKS} +BUILDSYMLINKS.s+= ${_SL} +BUILDSYMLINKS.t+= ${_TL} +${_TL}: ${_SL} + ${_MKMSG} "symlink " ${.CURDIR:T}/${.TARGET} + rm -f ${.TARGET} + ln -s ${.ALLSRC} ${.TARGET} +.endfor + +realall: ${BUILDSYMLINKS.t} + +CLEANDIRFILES+= ${BUILDSYMLINKS.t} + +.endif # } + +# +# .uue -> "" handling (i.e. decode a given binary/object) +# +# UUDECODE_FILES - List of files which are stored in the source tree +# as .uue and should be uudecoded. +# +# UUDECODE_FILES_RENAME_fn - For this file, rename its output to the provided +# name (handled via -p and redirecting stdout) + +.if defined(UUDECODE_FILES) # { +.SUFFIXES: .uue + +.uue: + ${_MKTARGET_CREATE} + rm -f ${.TARGET} + ${TOOL_UUDECODE} -p ${.IMPSRC} > ${.TARGET} + +.if defined(UUDECODE_FILES_RENAME_${UUDECODE_FILES}) +${UUDECODE_FILES_RENAME_${UUDECODE_FILES}}: ${UUDECODE_FILES} + cp ${.ALLSRC} ${.TARGET} +.endif + +realall: ${UUDECODE_FILES} + +CLEANUUDECODE_FILES=${UUDECODE_FILES} +.for i in ${UUDECODE_FILES} +CLEANUUDECODE_FILES+=${UUDECODE_FILES_RENAME_${i}} +.endfor + +CLEANFILES+= ${CLEANUUDECODE_FILES} +.endif # } + +##### Pull in related .mk logic +.include +.include +.include + +.endif # !defined(_BSD_FILES_MK_) diff --git a/src/share/mk/ubix.gcc.mk b/src/share/mk/ubix.gcc.mk new file mode 100644 index 0000000..916bb66 --- /dev/null +++ b/src/share/mk/ubix.gcc.mk @@ -0,0 +1,34 @@ +# $NetBSD: bsd.gcc.mk,v 1.11 2015/06/07 15:04:28 matt Exp $ + +.if !defined(_BSD_GCC_MK_) +_BSD_GCC_MK_=1 + +.if defined(EXTERNAL_TOOLCHAIN) +_GCC_CRTBEGIN!= ${CC} --print-file-name=crtbegin.o +.ifndef _GCC_CRTBEGINS +_GCC_CRTBEGINS!= ${CC} --print-file-name=crtbeginS.o +.endif +_GCC_CRTEND!= ${CC} --print-file-name=crtend.o +.ifndef _GCC_CRTENDS +_GCC_CRTENDS!= ${CC} --print-file-name=crtendS.o +.endif +.ifndef _GCC_CRTI +_GCC_CRTI!= ${CC} --print-file-name=crti.o +.endif +.ifndef _GCC_CRTN +_GCC_CRTN!= ${CC} --print-file-name=crtn.o +.endif +_GCC_CRTDIR!= dirname ${_GCC_CRTBEGIN} +_GCC_LIBGCCDIR!= dirname `${CC} --print-libgcc-file-name` +.else +_GCC_CRTBEGIN?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtbegin.o +_GCC_CRTBEGINS?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtbeginS.o +_GCC_CRTEND?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtend.o +_GCC_CRTENDS?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtendS.o +_GCC_CRTI?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o +_GCC_CRTN?= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtn.o +_GCC_CRTDIR?= ${DESTDIR}/usr/lib${MLIBDIR:D/${MLIBDIR}} +_GCC_LIBGCCDIR?= ${DESTDIR}/usr/lib${MLIBDIR:D/${MLIBDIR}} +.endif + +.endif # ! defined(_BSD_GCC_MK_) diff --git a/src/share/mk/ubix.gcov.mk b/src/share/mk/ubix.gcov.mk new file mode 100644 index 0000000..42ae988 --- /dev/null +++ b/src/share/mk/ubix.gcov.mk @@ -0,0 +1,51 @@ +LCOV=lcov.$(PROG) +CLEANFILES+= *.gcno *.gcda $(LCOV) + +# Right now we support obtaining coverage information for system services only, +# and for their main program code (not including their libraries) only. +# +# Why not userland as well: because we do not care as much, and it should be +# possible to produce coverage information for system services without +# recompiling the entire system with coverage support. Moreover, as of writing +# we do not have libprofile_rt, making it impossible to compile regular +# programs with coverage support altogether. +# +# Why not system service libraries (eg libsys) as well: practical concerns.. +# 1) As of writing, even for such libraries we make a regular and a PIC +# version, both producing a .gcno file for each object. The PIC version is +# compiled last, while the regular version is used for the library archive. +# The result is a potential mismatch between the compile-time coverage +# metadata and the run-time coverage counts. +# 2) The kernel has no coverage support, and with its self-relocation it would +# be tricky to add support for it. As a result, libraries used by the +# kernel would have to be excluded from being compiled with coverage support +# so as not to create problems. One could argue that that is a good thing +# because eg libminc and libsys create too many small result units (see also +# the current hardcoded limit in libsys/llvm_gcov.c). +# 3) gcov-pull(8) strips paths, which results in lots of manual work to figure +# out what file belongs to which library, even ignoring object name +# conflicts, for example between libraries. +# 4) In order to produce practically useful results ("how much of libsockevent +# is covered by the combination of LWIP and UDS" etc), gcov-pull(8) would +# have to be extended with support for merging .gcda files. The standard +# LLVM libprofile_rt implementation supports this, but we do not. +# All of these issues are solvable, but for now anyone interested in coverage +# for a particular system service library will have to mess with individual +# makefiles themselves. + +.if ${MKCOVERAGE:Uno} == "yes" +.if ${ACTIVE_CC} == "gcc" +# Leftovers for GCC. It is not clear whether these still work at all. +COVCPPFLAGS?= -fno-builtin -fprofile-arcs -ftest-coverage +COVLDADD?= -lgcov +.else # ${ACTIVE_CC} != "gcc" +# We assume LLVM/clang here. For other compilers this will likely break the +# MKCOVERAGE compilation, which is a good indication that support for them +# should be added here. +COVCPPFLAGS?= --coverage -g -O0 +COVLDADD?= +.endif # ${ACTIVE_CC} != "gcc" +.endif # ${MKCOVERAGE:Uno} == "yes" + +lcov: + lcov -c -d . >$(LCOV) diff --git a/src/share/mk/ubix.hostlib.mk b/src/share/mk/ubix.hostlib.mk new file mode 100644 index 0000000..debf501 --- /dev/null +++ b/src/share/mk/ubix.hostlib.mk @@ -0,0 +1,57 @@ +# $NetBSD: bsd.hostlib.mk,v 1.19 2014/12/01 01:34:30 erh Exp $ + +.include +.include + +##### Basic targets + +##### Default values +CFLAGS+= ${COPTS} +MKDEP_SUFFIXES?= .o .lo .d + +# Override these: +MKDEP:= ${HOST_MKDEP} +MKDEPCXX:= ${HOST_MKDEPCXX} + +.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) +OBJHOSTMACHINE= # set +.endif + +##### Build rules +.if defined(HOSTLIB) +_YHLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} +DPSRCS+= ${_YHLSRCS} +CLEANFILES+= ${_YHLSRCS} +.endif # defined(HOSTLIB) + +.if !empty(SRCS:N*.h:N*.sh) +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g} +.endif + +.if defined(OBJS) && !empty(OBJS) +.NOPATH: lib${HOSTLIB}.a ${OBJS} ${_YHLSRCS} + +${OBJS}: ${DPSRCS} + +lib${HOSTLIB}.a: ${OBJS} ${DPADD} + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${HOST_AR} cq ${.TARGET} ${OBJS} + ${HOST_RANLIB} ${.TARGET} + +.endif # defined(OBJS) && !empty(OBJS) + +realall: lib${HOSTLIB}.a + +CLEANFILES+= a.out [Ee]rrs mklog core *.core lib${HOSTLIB}.a ${OBJS} + +beforedepend: +CFLAGS:= ${HOST_CFLAGS} +CPPFLAGS:= ${HOST_CPPFLAGS} + +##### Pull in related .mk logic +.include +.include +.include + +${TARGETS}: # ensure existence diff --git a/src/share/mk/ubix.hostprog.mk b/src/share/mk/ubix.hostprog.mk new file mode 100644 index 0000000..9b2b99d --- /dev/null +++ b/src/share/mk/ubix.hostprog.mk @@ -0,0 +1,172 @@ +# $NetBSD: bsd.hostprog.mk,v 1.74 2014/12/01 01:34:30 erh Exp $ +# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 + +.include +.include + +##### Basic targets + +##### Default values +LIBATF_C?= /usr/lib/libatf-c.a +LIBATF_CXX?= /usr/lib/libatf-c++.a +LIBBLUETOOTH?= /usr/lib/libbluetooth.a +LIBBZ2?= /usr/lib/libbz2.a +LIBC?= /usr/lib/libc.a +LIBC_PIC?= /usr/lib/libc_pic.a +LIBC_SO?= /usr/lib/libc.so +LIBCOMPAT?= /usr/lib/libcompat.a +LIBCRYPT?= /usr/lib/libcrypt.a +LIBCURSES?= /usr/lib/libcurses.a +LIBDBM?= /usr/lib/libdbm.a +LIBDES?= /usr/lib/libdes.a +LIBEDIT?= /usr/lib/libedit.a +LIBEVENT?= /usr/lib/libevent.a +LIBEVENT_OPENSSL?= /usr/lib/libevent_openssl.a +LIBEVENT_PTHREADS?= /usr/lib/libevent_pthreads.a +LIBEXPAT?= /usr/lib/libexpat.a +LIBFETCH?= /usr/lib/libfetch.a +LIBFORM?= /usr/lib/libform.a +LIBGCC?= /usr/lib/libgcc.a +LIBGNUMALLOC?= /usr/lib/libgnumalloc.a +LIBINTL?= /usr/lib/libintl.a +LIBIPSEC?= /usr/lib/libipsec.a +LIBKVM?= /usr/lib/libkvm.a +LIBL?= /usr/lib/libl.a +LIBLUTOK?= /usr/lib/liblutok.a +LIBLZMA?= /usr/lib/liblzma.a +LIBM?= /usr/lib/libm.a +LIBMAGIC?= /usr/lib/libmagic.a +LIBMENU?= /usr/lib/libmenu.a +LIBMP?= /usr/lib/libmp.a +LIBNTP?= /usr/lib/libntp.a +LIBOBJC?= /usr/lib/libobjc.a +LIBP2K?= /usr/lib/libp2k.a +LIBPC?= /usr/lib/libpc.a +LIBPCAP?= /usr/lib/libpcap.a +LIBPCI?= /usr/lib/libpci.a +LIBPLOT?= /usr/lib/libplot.a +LIBPOSIX?= /usr/lib/libposix.a +LIBPUFFS?= /usr/lib/libpuffs.a +LIBQUOTA?= /usr/lib/libquota.a +LIBRESOLV?= /usr/lib/libresolv.a +LIBRPCSVC?= /usr/lib/librpcsvc.a +LIBRUMP?= /usr/lib/librump.a +LIBRUMPCLIENT?= /usr/lib/librumpclient.a +LIBRUMPNET?= /usr/lib/librumpnet.a +LIBRUMPUSER?= /usr/lib/librumpuser.a +LIBRUMPVFS?= /usr/lib/librumpvfs.a +LIBSKEY?= /usr/lib/libskey.a +LIBSQLITE3?= /usr/lib/libsqlite3.a +LIBSSP?= /usr/lib/libssp.a +LIBSTDCXX?= /usr/lib/libstdc++.a +LIBSUPCXX?= /usr/lib/libsupc++.a +LIBTERMINFO?= /usr/lib/libterminfo.a +LIBUTIL?= /usr/lib/libutil.a +LIBWRAP?= /usr/lib/libwrap.a +LIBUKFS?= /usr/lib/libukfs.a +LIBY?= /usr/lib/liby.a +LIBZ?= /usr/lib/libz.a + +##### rump file system modules +LIBRUMPFS_CD9660FS?= /usr/lib/librumpfs_cd9660fs.a +LIBRUMPFS_EFS?= /usr/lib/librumpfs_efs.a +LIBRUMPFS_EXT2FS?= /usr/lib/librumpfs_ext2fs.a +LIBRUMPFS_FFS?= /usr/lib/librumpfs_ffs.a +LIBRUMPFS_HFS?= /usr/lib/librumpfs_hfs.a +LIBRUMPFS_LFS?= /usr/lib/librumpfs_lfs.a +LIBRUMPFS_MSDOSFS?= /usr/lib/librumpfs_msdosfs.a +LIBRUMPFS_NTFS?= /usr/lib/librumpfs_ntfs.a +LIBRUMPFS_SYSPUFFS?= /usr/lib/librumpfs_syspuffs.a +LIBRUMPFS_TMPFS?= /usr/lib/librumpfs_tmpfs.a +LIBRUMPFS_UDF?= /usr/lib/librumpfs_udf.a +LIBRUMPFS_UFS?= /usr/lib/librumpfs_ufs.a + +MKDEP_SUFFIXES?= .lo .ln .d + +# Override these: +INSTALL:= ${INSTALL:NSTRIP=*} +MKDEP:= ${HOST_MKDEP} +MKDEPCXX:= ${HOST_MKDEPCXX} + +.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) +OBJHOSTMACHINE= # set +.endif + +##### Build rules +.if defined(HOSTPROG_CXX) +HOSTPROG= ${HOSTPROG_CXX} +.endif + +.if defined(HOSTPROG) +SRCS?= ${HOSTPROG}.c + +_YHPSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} +DPSRCS+= ${_YHPSRCS} +CLEANFILES+= ${_YHPSRCS} + +.if !empty(SRCS:N*.h:N*.sh) +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g} +LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} +.endif + +.if defined(OBJS) && !empty(OBJS) +.NOPATH: ${OBJS} ${HOSTPROG} ${_YHPSRCS} + +${OBJS} ${LOBJS}: ${DPSRCS} +${HOSTPROG}: ${OBJS} ${DPADD} + ${_MKTARGET_LINK} + ${HOST_LINK.c} ${HOST_LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} +.if !empty(.MAKE.OS:M*CYGWIN*) + ${HOST_SH} ${NETBSDSRCDIR}/tools/binstall/mkmanifest ${HOSTPROG} +.endif + + +.endif # defined(OBJS) && !empty(OBJS) + +.if !defined(MAN) +MAN= ${HOSTPROG}.1 +.endif # !defined(MAN) +.endif # defined(HOSTPROG) + +realall: ${HOSTPROG} + +CLEANFILES+= a.out [Ee]rrs mklog core *.core ${HOSTPROG} ${OBJS} ${LOBJS} + +beforedepend: +CFLAGS:= ${HOST_CFLAGS} +CPPFLAGS:= ${HOST_CPPFLAGS:N-Wp,-iremap,*} + +lint: ${LOBJS} +.if defined(LOBJS) && !empty(LOBJS) + ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD} +.endif + +##### Pull in related .mk logic +LINKSMODE?= ${BINMODE} +.include +.include +.include +.include +.include +.include +.include + +${TARGETS}: # ensure existence + +# Override YACC/LEX rules so nbtool_config.h can be forced as the 1st include +.l.c: + ${_MKTARGET_LEX} + ${LEX.l} -o${.TARGET} ${.IMPSRC} + echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1 + echo '#include "nbtool_config.h"' >> ${.TARGET}.1 + echo '#endif' >> ${.TARGET}.1 + cat ${.TARGET} >> ${.TARGET}.1 + mv ${.TARGET}.1 ${.TARGET} +.y.c: + ${_MKTARGET_YACC} + ${YACC.y} -o ${.TARGET} ${.IMPSRC} + echo '#if HAVE_NBTOOL_CONFIG_H' > ${.TARGET}.1 + echo '#include "nbtool_config.h"' >> ${.TARGET}.1 + echo '#endif' >> ${.TARGET}.1 + cat ${.TARGET} >> ${.TARGET}.1 + mv ${.TARGET}.1 ${.TARGET} diff --git a/src/share/mk/ubix.inc.mk b/src/share/mk/ubix.inc.mk new file mode 100644 index 0000000..9672743 --- /dev/null +++ b/src/share/mk/ubix.inc.mk @@ -0,0 +1,57 @@ +# $NetBSD: bsd.inc.mk,v 1.32 2006/03/16 18:43:34 jwise Exp $ + +.include + +##### Basic targets +includes: ${INCS} incinstall inclinkinstall + +##### Default values +INCSYMLINKS?= + +##### Install rules +incinstall:: # ensure existence +.PHONY: incinstall + +# -c is forced on here, in order to preserve modtimes for "make depend" +__incinstall: .USE + @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ + (${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}) + +.for F in ${INCS:O:u} +_FDIR:= ${INCSDIR_${F:C,/,_,g}:U${INCSDIR}} # dir override +_FNAME:= ${INCSNAME_${F:C,/,_,g}:U${INCSNAME:U${F}}} # name override +_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path + +.if ${MKUPDATE} == "no" +${_F}! ${F} __incinstall # install rule +.else +${_F}: ${F} __incinstall # install rule +.endif + +incinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _FDIR +.undef _FNAME +.undef _F + +inclinkinstall: .PHONY +.if !empty(INCSYMLINKS) + @(set ${INCSYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; shift; \ + t=${DESTDIR}$$1; shift; \ + if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ + [ "$$l" = "$$ttarg" ]; then \ + continue ; \ + fi ; \ + ${_MKSHMSG_INSTALL} $$t; \ + ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ + done; ) +.endif diff --git a/src/share/mk/ubix.info.mk b/src/share/mk/ubix.info.mk new file mode 100644 index 0000000..ef6bd1f --- /dev/null +++ b/src/share/mk/ubix.info.mk @@ -0,0 +1,87 @@ +# $NetBSD: bsd.info.mk,v 1.40 2011/09/10 16:57:35 apb Exp $ + +.include + +##### Basic targets +realinstall: infoinstall + +##### Default values +INFOFLAGS?= + +INFOFILES?= + +##### Build rules +.if ${MKINFO} != "no" + +INFOFILES= ${TEXINFO:C/\.te?xi(nfo)?$/.info/} + +realall: ${INFOFILES} +.NOPATH: ${INFOFILES} + +.SUFFIXES: .txi .texi .texinfo .info + +.txi.info .texi.info .texinfo.info: + ${_MKTARGET_CREATE} + ${TOOL_MAKEINFO} ${INFOFLAGS} --no-split --no-version-header -o ${.TARGET} ${.IMPSRC} + +.endif # ${MKINFO} != "no" + +##### Install rules +infoinstall:: # ensure existence +.PHONY: infoinstall + +.if ${MKINFO} != "no" + +INFODIRFILE=${DESTDIR}${INFODIR}/dir + +# serialize access to ${INFODIRFILE}; needed for parallel makes +__infoinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} \ + -o ${INFOOWN_${.ALLSRC:T}:U${INFOOWN}} \ + -g ${INFOGRP_${.ALLSRC:T}:U${INFOGRP}} \ + -m ${INFOMODE_${.ALLSRC:T}:U${INFOMODE}} \ + ${.ALLSRC} ${.TARGET} + @[ -f ${INFODIRFILE} ] && \ + while ! ln ${INFODIRFILE} ${INFODIRFILE}.lock 2> /dev/null; \ + do sleep 1; done; \ + ${TOOL_INSTALL_INFO} -d ${INFODIRFILE} -r ${.TARGET} 2> /dev/null; \ + ${TOOL_INSTALL_INFO} -d ${INFODIRFILE} ${.TARGET}; \ + rm -f ${INFODIRFILE}.lock + + +.for F in ${INFOFILES:O:u} +_FDIR:= ${INFODIR_${F}:U${INFODIR}} # dir overrides +_FNAME:= ${INFONAME_${F}:U${INFONAME:U${F:T}}} # name overrides +_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path + +.if ${MKUPDATE} == "no" +${_F}! ${F} __infoinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __infoinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +infoinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _FDIR +.undef _FNAME +.undef _F +.endif # ${MKINFO} != "no" + +##### Clean rules +CLEANDIRFILES+= ${INFOFILES} + +##### Pull in related .mk logic +.include +.include +.include + +${TARGETS}: # ensure existence diff --git a/src/share/mk/ubix.init.mk b/src/share/mk/ubix.init.mk index 2831197..22dc168 100644 --- a/src/share/mk/ubix.init.mk +++ b/src/share/mk/ubix.init.mk @@ -1,6 +1,13 @@ -.if !defined(_UBIX_INIT_MK_) -_UBIX_INIT_MK_=1 -.-include "${.CURDIR}/../Makefile.incl" -.include -.MAIN: all -.endif # !defined(_UBIX_INIT_MK_) +# $NetBSD: bsd.init.mk,v 1.2 2003/07/28 02:38:33 lukem Exp $ + +# includes Makefile.inc and ; this is used at the +# top of all files which actually "build something". + +.if !defined(_BSD_INIT_MK_) +_BSD_INIT_MK_=1 + +.-include "${.CURDIR}/../Makefile.inc" +.include +.MAIN: all + +.endif # !defined(_BSD_INIT_MK_) diff --git a/src/share/mk/ubix.ioconf.mk b/src/share/mk/ubix.ioconf.mk new file mode 100644 index 0000000..c1acac5 --- /dev/null +++ b/src/share/mk/ubix.ioconf.mk @@ -0,0 +1,41 @@ +# $NetBSD: bsd.ioconf.mk,v 1.5 2014/11/30 15:53:29 uebayasi Exp $ +# + +.include + +# If IOCONF is defined, autocreate ioconf.[ch] and locators.h. +# This is useful mainly for devices. +.if !empty(IOCONF) + +# discourage direct inclusion. bsd.ioconf.mk will hopefully go away +# when the kernel build procedures are unified. +.if defined(_BSD_IOCONF_MK_USER_) + +# XXX: ioconf.c doesn't need to depend on TOOL_CONFIG, but that helps +# keep builds working while hashing out some of the experimental +# features related to ioconf. +.if ${USETOOLS} == "yes" +CONFIGDEP=${TOOL_CONFIG} +.endif +ioconf.c: ${IOCONF} ${CONFIGDEP} + ${TOOL_CONFIG} ${CONFIGOPTS} -b ${.OBJDIR} -s ${S} \ + ${IOCONFDIR:U${.CURDIR}}/${IOCONF} + # config doesn't change the files if they're unchanged. however, + # here we want to satisfy our make dependency, so force a + # timestamp update + touch ioconf.c ioconf.h locators.h + +.else # _BSD_IOCONF_MK_USER_ + +ioconf.c: + @echo do not include bsd.ioconf.mk directly + @false + +.endif # _BSD_IOCONF_MK_USER_ + +locators.h: ioconf.c +ioconf.h: ioconf.c + +CLEANFILES+= ioconf.c ioconf.h locators.h +DPSRCS+= ioconf.c ioconf.h locators.h +.endif diff --git a/src/share/mk/ubix.kernobj.mk b/src/share/mk/ubix.kernobj.mk new file mode 100644 index 0000000..ba3c9ed --- /dev/null +++ b/src/share/mk/ubix.kernobj.mk @@ -0,0 +1,33 @@ +# $NetBSD: bsd.kernobj.mk,v 1.14 2013/06/03 07:39:07 mrg Exp $ + +# KERNSRCDIR Is the location of the top of the kernel src. +# It defaults to `${NETBSDSRCDIR}/sys'. +# +# KERNARCHDIR Is the location of the machine dependent kernel sources. +# It defaults to `arch/${MACHINE}', but may be overridden +# in case ${MACHINE} is not correct. +# +# KERNCONFDIRDEFAULT Is the default for ${KERNCONFDIR}. +# It defaults to `${KERNSRCDIR}/${KERNARCHDIR}/conf'. +# +# KERNCONFDIR Is where the configuration files for kernels are found. +# Users can set this to have build.sh find kernel +# configurations in another directory. +# It defaults to `${KERNCONFDIRDEFAULT}'. +# +# KERNOBJDIR Is the kernel build directory. The kernel GENERIC for +# instance will be compiled in ${KERNOBJDIR}/GENERIC. +# The default is the .OBJDIR of +# `${KERNSRCDIR}/${KERNARCHDIR}/compile'. +# + +.include + +KERNSRCDIR?= ${NETBSDSRCDIR}/sys +KERNARCHDIR?= arch/${MACHINE} +KERNCONFDIRDEFAULT?= ${KERNSRCDIR}/${KERNARCHDIR}/conf +KERNCONFDIR?= ${KERNCONFDIRDEFAULT} + +.if !defined(KERNOBJDIR) && exists(${KERNSRCDIR}/${KERNARCHDIR}/compile) +KERNOBJDIR!= cd "${KERNSRCDIR}/${KERNARCHDIR}/compile" && ${PRINTOBJDIR} +.endif diff --git a/src/share/mk/ubix.kinc.mk b/src/share/mk/ubix.kinc.mk new file mode 100644 index 0000000..bb4b035 --- /dev/null +++ b/src/share/mk/ubix.kinc.mk @@ -0,0 +1,84 @@ +# $NetBSD: bsd.kinc.mk,v 1.36 2006/03/16 18:43:34 jwise Exp $ + +# Variables: +# +# INCSDIR Directory to install includes into (and/or make, and/or +# symlink, depending on what's going on). +# +# INCS Headers to install. +# +# DEPINCS Headers to install which are built dynamically. +# +# SUBDIR Subdirectories to enter +# +# INCSYMLINKS 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. +# + +.include + +##### Basic targets +.PRECIOUS: ${DESTDIR}${INCSDIR} +includes: ${DESTDIR}${INCSDIR} .WAIT ${INCS} incinstall + +##### Install rules +incinstall:: # ensure existence +.PHONY: incinstall + +# make sure the directory is OK, and install includes. + +${DESTDIR}${INCSDIR}: .EXEC + @if [ ! -d ${.TARGET} ] || [ -h ${.TARGET} ] ; then \ + ${_MKSHMSG_CREATE} ${.TARGET}; \ + /bin/rm -rf ${.TARGET}; \ + ${_MKSHECHO} ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.TARGET}; \ + ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.TARGET}; \ + fi + +# -c is forced on here, in order to preserve modtimes for "make depend" +__incinstall: .USE + @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ + (${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \ + -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}) + +.for F in ${INCS:O:u} ${DEPINCS:O:u} +_F:= ${DESTDIR}${INCSDIR}/${F} # installed path + +.if ${MKUPDATE} == "no" +${_F}! ${F} __incinstall # install rule +.else +${_F}: ${F} __incinstall # install rule +.endif + +incinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _F + +.if defined(INCSYMLINKS) && !empty(INCSYMLINKS) +incinstall:: + @(set ${INCSYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; shift; \ + t=${DESTDIR}$$1; shift; \ + if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ + [ "$$l" = "$$ttarg" ]; then \ + continue ; \ + fi ; \ + ${_MKSHMSG_INSTALL} $$t; \ + ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ + done; ) +.endif + +##### Pull in related .mk logic +.include +.include diff --git a/src/share/mk/ubix.klinks.mk b/src/share/mk/ubix.klinks.mk new file mode 100644 index 0000000..2616e4a --- /dev/null +++ b/src/share/mk/ubix.klinks.mk @@ -0,0 +1,87 @@ +# $NetBSD: bsd.klinks.mk,v 1.13 2014/08/10 05:57:31 matt Exp $ +# + +.include + +KLINK_MACHINE?= ${MACHINE} + +##### Default values +.if !defined(S) +.if defined(NETBSDSRCDIR) +S= ${NETBSDSRCDIR}/sys +.elif defined(BSDSRCDIR) +S= ${BSDSRCDIR}/sys +.else +S= /sys +.endif +.endif + +CLEANFILES+= machine ${MACHINE_CPU} ${KLINK_MACHINE} +.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" +CLEANFILES+= sun68k +.elif ${KLINK_MACHINE} == "sparc64" +CLEANFILES+= sparc +.elif ${KLINK_MACHINE} == "i386" +CLEANFILES+= x86 +.elif ${KLINK_MACHINE} == "amd64" +CLEANFILES+= x86 i386 +.elif ${KLINK_MACHINE} == "evbmips" +CLEANFILES+= algor sbmips +.elif ${MACHINE_CPU} == "aarch64" +CLEANFILES+= arm +.endif + +.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" +CLEANFILES+= xen xen-ma/machine # xen-ma +CPPFLAGS+= -I${.OBJDIR}/xen-ma +.if ${MACHINE_CPU} == "i386" +CLEANFILES+= x86 +.endif +.endif + +# XXX. This should be done a better way. It's @'d to reduce visual spew. +# XXX .BEGIN is used to make sure the links are done before anything else. +.if !make(obj) && !make(clean) && !make(cleandir) +.BEGIN: + -@rm -f machine && \ + ln -s $S/arch/${KLINK_MACHINE}/include machine + -@rm -f ${KLINK_MACHINE} && \ + ln -s $S/arch/${KLINK_MACHINE}/include ${KLINK_MACHINE} + -@if [ -d $S/arch/${MACHINE_CPU} ]; then \ + rm -f ${MACHINE_CPU} && \ + ln -s $S/arch/${MACHINE_CPU}/include ${MACHINE_CPU}; \ + fi +# XXX. it gets worse.. +.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" + -@rm -f sun68k && \ + ln -s $S/arch/sun68k/include sun68k +.endif +.if ${KLINK_MACHINE} == "sparc64" + -@rm -f sparc && \ + ln -s $S/arch/sparc/include sparc +.endif +.if ${KLINK_MACHINE} == "amd64" + -@rm -f i386 && \ + ln -s $S/arch/i386/include i386 +.endif +.if ${MACHINE_CPU} == "i386" || ${MACHINE_CPU} == "x86_64" + -@rm -f x86 && \ + ln -s $S/arch/x86/include x86 +.endif +.if ${MACHINE_CPU} == "aarch64" + -@rm -f arm && \ + ln -s $S/arch/arm/include arm +.endif +.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" + -@rm -f xen && \ + ln -s $S/arch/xen/include xen + -@rm -rf xen-ma && mkdir xen-ma && \ + ln -s ../${XEN_BUILD:U${MACHINE_ARCH}} xen-ma/machine +.endif +.if ${KLINK_MACHINE} == "evbmips" + -@rm -f algor && \ + ln -s $S/arch/algor/include algor + -@rm -f sbmips && \ + ln -s $S/arch/sbmips/include sbmips +.endif +.endif diff --git a/src/share/mk/ubix.kmodule.mk b/src/share/mk/ubix.kmodule.mk new file mode 100644 index 0000000..970bb6a --- /dev/null +++ b/src/share/mk/ubix.kmodule.mk @@ -0,0 +1,249 @@ +# $NetBSD: bsd.kmodule.mk,v 1.55 2015/07/09 14:50:08 matt Exp $ + +# We are not building this with PIE +MKPIE=no + +.include +.include +.include + +##### Basic targets +realinstall: kmodinstall + +KERN= $S/kern +MKLDSCRIPT?= no + +CFLAGS+= -ffreestanding ${COPTS} +CPPFLAGS+= -nostdinc -I. -I${.CURDIR} -isystem $S -isystem $S/arch +CPPFLAGS+= -isystem ${S}/../common/include +CPPFLAGS+= -D_KERNEL -D_LKM -D_MODULE -DSYSCTL_INCLUDE_DESCR + +# XXX until the kernel is fixed again... +CFLAGS+= -fno-strict-aliasing -Wno-pointer-sign + +# XXX This is a workaround for platforms that have relative relocations +# that, when relocated by the module loader, result in addresses that +# overflow the size of the relocation (e.g. R_PPC_REL24 in powerpc). +# The real solution to this involves generating trampolines for those +# relocations inside the loader and removing this workaround, as the +# resulting code would be much faster. +.if ${MACHINE_CPU} == "arm" +CFLAGS+= -fno-common -fno-unwind-tables +.elif ${MACHINE_CPU} == "hppa" +CFLAGS+= -mlong-calls +.elif ${MACHINE_CPU} == "powerpc" +CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mlongcall :} +.elif ${MACHINE_CPU} == "vax" +CFLAGS+= -fno-pic +.elif ${MACHINE_CPU} == "riscv" +CFLAGS+= -fPIC -Wa,-fno-pic +.elif ${MACHINE_ARCH} == "mips64eb" && !defined(BSD_MK_COMPAT_FILE) +CFLAGS+= -mabi=64 +LDFLAGS+= -Wl,-m,elf64btsmip +.elif ${MACHINE_ARCH} == "mips64el" && !defined(BSD_MK_COMPAT_FILE) +CFLAGS+= -mabi=64 +LDFLAGS+= -Wl,-m,elf64ltsmip +.endif + +.if ${MACHINE_CPU} == "sparc64" +# force same memory model as rest of the kernel +CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :} +CFLAGS+= ${${ACTIVE_CC} == "clang":? -mcmodel=small :} +.endif + +# evbppc needs some special help +.if ${MACHINE} == "evbppc" + +. ifndef PPC_INTR_IMPL +PPC_INTR_IMPL=\"powerpc/intr.h\" +. endif +. ifndef PPC_PCI_MACHDEP_IMPL +PPC_PCI_MACHDEP_IMPL=\"powerpc/pci_machdep.h\" +. endif +CPPFLAGS+= -DPPC_INTR_IMPL=${PPC_INTR_IMPL} +CPPFLAGS+= -DPPC_PCI_MACHDEP_IMPL=${DPPC_PCI_MACHDEP_IMPL} + +. ifdef PPC_IBM4XX +CPPFLAGS+= -DPPC_IBM4XX +. elifdef PPC_BOOKE +CPPFLAGS+= -DPPC_BOOKE +. else +CPPFLAGS+= -DPPC_OEA +. endif + +.endif + + +_YKMSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} +DPSRCS+= ${_YKMSRCS} +CLEANFILES+= ${_YKMSRCS} + +.if exists($S/../sys/modules/xldscripts/kmodule) +KMODSCRIPTSRC= $S/../sys/modules/xldscripts/kmodule +.else +KMODSCRIPTSRC= ${DESTDIR}/usr/libdata/ldscripts/kmodule +.endif +.if ${MKLDSCRIPT} == "yes" +KMODSCRIPT= kldscript +MKLDSCRIPTSH= +.else +KMODSCRIPT= ${KMODSCRIPTSRC} +.endif + +PROG?= ${KMOD}.kmod + +##### Build rules +realall: ${PROG} + +.if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \ + && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE)) +.for f in ${SRCS:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g} +.if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \ + || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \ + || ${CXXFLAGS.$f:D5} == "5") \ + || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/})) +XOBJS+= ${f:R:S/$/.o/} +.else +XSRCS+= ${f} +NODPSRCS+= ${f} +.endif +.endfor + +.if !empty(XOBJS) +${XOBJS}: ${DPSRCS} +.endif + +.if ${MKLDSCRIPT} == "yes" +${KMODSCRIPT}: ${KMODSCRIPTSRC} ${XOBJS} $S/conf/mkldscript.sh + @rm -f ${.TARGET} + @OBJDUMP=${OBJDUMP} ${HOST_SH} $S/conf/mkldscript.sh \ + -t ${KMODSCRIPTSRC} ${XOBJS} > ${.TARGET} +.endif + +${PROG}: ${XOBJS} ${XSRCS} ${DPSRCS} ${DPADD} ${KMODSCRIPT} + ${CC} ${LDFLAGS} -nostdlib -MD -combine -r -Wl,-T,${KMODSCRIPT},-d \ + -Wl,-Map=${.TARGET}.map \ + -o ${.TARGET} ${CFLAGS} ${CPPFLAGS} ${XOBJS} \ + ${XSRCS:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} && \ + echo '.-include "${KMOD}.d"' > .depend + +.else +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} + +${OBJS} ${LOBJS}: ${DPSRCS} + +.if ${MKLDSCRIPT} == "yes" +${KMODSCRIPT}: ${KMODSCRIPTSRC} ${OBJS} $S/conf/mkldscript.sh + @rm -f ${.TARGET} + @OBJDUMP=${OBJDUMP} ${HOST_SH} $S/conf/mkldscript.sh \ + -t ${KMODSCRIPTSRC} ${OBJS} > ${.TARGET} +.endif + +.if ${MACHINE_CPU} == "arm" +# The solution to limited branch space involves generating trampolines for +# those relocations while creating the module, as the resulting code will +# be much faster and simplifies the loader. +ARCHDIR= $S/modules/arch/${MACHINE_CPU} +ASM_H= $S/arch/${MACHINE_CPU}/include/asm.h +CLEANFILES+= tmp.o tmp.S ${KMOD}_tmp.o ${KMOD}_tramp.o ${KMOD}_tramp.S +${KMOD}_tmp.o: ${OBJS} ${DPADD} + ${_MKTARGET_LINK} + ${LD} -r -o tmp.o ${OBJS} + ${LD} -r \ + `${OBJDUMP} --syms --reloc tmp.o | \ + ${TOOL_AWK} -f ${ARCHDIR}/kmodwrap.awk` \ + -o ${.TARGET} tmp.o + +${KMOD}_tramp.S: ${KMOD}_tmp.o ${ARCHDIR}/kmodtramp.awk ${ASM_H} + ${_MKTARGET_CREATE} + ${OBJDUMP} --syms --reloc ${KMOD}_tmp.o | \ + ${TOOL_AWK} -f ${ARCHDIR}/kmodtramp.awk \ + > tmp.S && \ + mv tmp.S ${.TARGET} + +${PROG}: ${KMOD}_tmp.o ${KMOD}_tramp.o + ${_MKTARGET_LINK} +.if exists(${ARCHDIR}/kmodhide.awk) + ${LD} -r -Map=${.TARGET}.map \ + -o tmp.o ${KMOD}_tmp.o ${KMOD}_tramp.o + ${OBJCOPY} \ + `${NM} tmp.o | ${TOOL_AWK} -f ${ARCHDIR}/kmodhide.awk` \ + tmp.o ${.TARGET} && \ + rm tmp.o +.else + ${LD} -r -Map=${.TARGET}.map \ + -o ${.TARGET} ${KMOD}_tmp.o ${KMOD}_tramp.o +.endif +.else +${PROG}: ${OBJS} ${DPADD} ${KMODSCRIPT} + ${_MKTARGET_LINK} + ${CC} ${LDFLAGS} -nostdlib -r -Wl,-T,${KMODSCRIPT},-d \ + -Wl,-Map=${.TARGET}.map \ + -o ${.TARGET} ${OBJS} +.endif +.endif + +##### Install rules +.if !target(kmodinstall) +.if !defined(KMODULEDIR) +_OSRELEASE!= ${HOST_SH} $S/conf/osrelease.sh -k +# Ensure these are recorded properly in METALOG on unprived installes: +KMODULEARCHDIR?= ${MACHINE} +_INST_DIRS= ${DESTDIR}/stand/${KMODULEARCHDIR} +_INST_DIRS+= ${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE} +_INST_DIRS+= ${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules +KMODULEDIR= ${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules/${KMOD} +.endif +_PROG:= ${KMODULEDIR}/${PROG} # installed path + +.if ${MKUPDATE} == "no" +${_PROG}! ${PROG} # install rule +.if !defined(BUILD) && !make(all) && !make(${PROG}) +${_PROG}! .MADE # no build at install +.endif +.else +${_PROG}: ${PROG} # install rule +.if !defined(BUILD) && !make(all) && !make(${PROG}) +${_PROG}: .MADE # no build at install +.endif +.endif + ${_MKTARGET_INSTALL} + dirs=${_INST_DIRS:Q}; \ + for d in $$dirs; do \ + ${INSTALL_DIR} $$d; \ + done + ${INSTALL_DIR} ${KMODULEDIR} + ${INSTALL_FILE} -o ${KMODULEOWN} -g ${KMODULEGRP} -m ${KMODULEMODE} \ + ${.ALLSRC} ${.TARGET} + +kmodinstall:: ${_PROG} +.PHONY: kmodinstall +.PRECIOUS: ${_PROG} # keep if install fails + +.undef _PROG +.endif # !target(kmodinstall) + +##### Clean rules +CLEANFILES+= a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${LOBJS} +CLEANFILES+= ${PROG}.map +.if ${MKLDSCRIPT} == "yes" +CLEANFILES+= kldscript +.endif + +##### Custom rules +lint: ${LOBJS} +.if defined(LOBJS) && !empty(LOBJS) + ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD} +.endif + +##### Pull in related .mk logic +LINKSOWN?= ${KMODULEOWN} +LINKSGRP?= ${KMODULEGRP} +LINKSMODE?= ${KMODULEMODE} +.include +.include +.include +.include + +.-include "$S/arch/${MACHINE_CPU}/include/Makefile.inc" +.-include "$S/arch/${MACHINE}/include/Makefile.inc" diff --git a/src/share/mk/ubix.lib.mk b/src/share/mk/ubix.lib.mk new file mode 100644 index 0000000..73867e3 --- /dev/null +++ b/src/share/mk/ubix.lib.mk @@ -0,0 +1,968 @@ +# $NetBSD: bsd.lib.mk,v 1.362 2015/09/08 16:06:42 uebayasi Exp $ +# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 + +.include +.include +.include +# Pull in here so we can override its .c.o rule +.include + +LIBISMODULE?= no +LIBISPRIVATE?= no +LIBISCXX?= no + +.if ${LIBISMODULE} != "no" +_LIB_PREFIX?= # empty +MKDEBUGLIB:= no +MKLINT:= no +MKPICINSTALL:= no +MKPROFILE:= no +MKSTATICLIB:= no +.else +_LIB_PREFIX?= lib +.endif + +.if ${LIBISPRIVATE} != "no" +MKDEBUGLIB:= no +MKLINT:= no +MKPICINSTALL:= no +. if defined(NOSTATICLIB) && ${MKPICLIB} != "no" +MKSTATICLIB:= no +. else +MKPIC:= no +. endif +MKPROFILE:= no +.endif + +##### Basic targets +.PHONY: checkver libinstall +realinstall: checkver libinstall + +##### LIB specific flags. +# XXX: This is needed for programs that link with .a libraries +# Perhaps a more correct solution is to always generate _pic.a +# files or always have a shared library. +.if defined(MKPIE) && (${MKPIE} != "no") +CFLAGS+= ${PIE_CFLAGS} +AFLAGS+= ${PIE_AFLAGS} +.endif + +##### Libraries that this may depend upon. +.if defined(LIBDPLIBS) && ${MKPIC} != "no" # { +.for _lib _dir in ${LIBDPLIBS} +.if !defined(LIBDO.${_lib}) +LIBDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} +.MAKEOVERRIDES+=LIBDO.${_lib} +.endif +.if ${LIBDO.${_lib}} == "_external" +LDADD+= -l${_lib} +.else +LDADD+= -L${LIBDO.${_lib}} -l${_lib} +DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so # Don't use _LIB_PREFIX +.endif +.endfor +.endif # } + +##### Build and install rules +MKDEP_SUFFIXES?= .o .po .pico .go .ln .d + +.if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # { +SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major +SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor +SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny + +DPADD+= ${SHLIB_VERSION_FILE} + +# Check for higher installed library versions. +.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \ + exists(${NETBSDSRCDIR}/lib/checkver) +checkver: + @(cd "${.CURDIR}" && \ + HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \ + ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \ + -d ${_DEST.OBJ} ${LIB}) +.endif +.endif # } + +.if !target(checkver) +checkver: +.endif + +print-shlib-major: +.if defined(SHLIB_MAJOR) && ${MKPIC} != "no" + @echo ${SHLIB_MAJOR} +.else + @false +.endif + +print-shlib-minor: +.if defined(SHLIB_MINOR) && ${MKPIC} != "no" + @echo ${SHLIB_MINOR} +.else + @false +.endif + +print-shlib-teeny: +.if defined(SHLIB_TEENY) && ${MKPIC} != "no" + @echo ${SHLIB_TEENY} +.else + @false +.endif + +.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR) # { +.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR) +.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY) +SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY} +.else +SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} +.endif +.else +SHLIB_FULLVERSION=${SHLIB_MAJOR} +.endif +.endif # } + +# add additional suffixes not exported. +# .po is used for profiling object files. +# .pico is used for PIC object files. +.SUFFIXES: .out .a .ln .pico .po .go .o .s .S .c .cc .cpp .cxx .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. + +# Data-driven table using make variables to control how shared libraries +# are built for different platforms and object formats. +# SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version +# numbers of shared library +# 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_TEENY}]] +# 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 + +PICFLAGS ?= -fPIC + +.if ${MKPICLIB} != "no" +CSHLIBFLAGS+= ${PICFLAGS} +.endif + +.if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS) +MKSHLIBOBJS= yes +.else +MKSHLIBOBJS= no +.endif + +.if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \ + (defined(CFLAGS) && !empty(CFLAGS:M*-g*)) +# We only add -g to the shared library objects +# because we don't currently split .a archives. +CSHLIBFLAGS+= -g +.if ${LIBISPRIVATE} == "yes" +CFLAGS+= -g +.endif +.endif + +# Platform-independent linker flags for ELF shared libraries +SHLIB_SOVERSION= ${SHLIB_MAJOR} +SHLIB_SHFLAGS= -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION} +.if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no" +SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel +.endif +.if !defined(SHLIB_MKMAP) || ${SHLIB_MKMAP} != "no" +SHLIB_SHFLAGS+= -Wl,-Map=${_LIB}.so.${SHLIB_SOVERSION}.map +.endif +CLEANFILES+= ${_LIB}.so.${SHLIB_SOVERSION}.map +SHLIB_LDSTARTFILE?= ${_GCC_CRTI} ${_GCC_CRTBEGINS} +SHLIB_LDENDFILE?= ${_GCC_CRTENDS} ${_GCC_CRTN} + +CFLAGS+= ${COPTS} +OBJCFLAGS+= ${OBJCOPTS} +AFLAGS+= ${COPTS} +FFLAGS+= ${FOPTS} + +.if defined(CTFCONVERT) +.if defined(CFLAGS) && !empty(CFLAGS:M*-g*) +CTFFLAGS+= -g +.if defined(HAVE_GCC) && ${HAVE_GCC} >= 48 +#CFLAGS+= -gdwarf-2 +.endif +.endif +.endif + +LIBSTRIPAOBJS= yes +.if !defined(CFLAGS) || empty(CFLAGS:M*-g*) +LIBSTRIPCOBJS= yes +.endif +.if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*) +LIBSTRIPOBJCOBJS= yes +.endif +.if !defined(FFLAGS) || empty(FFLAGS:M*-g*) +LIBSTRIPFOBJS= yes +.endif +.if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*) +LIBSTRIPSHLIBOBJS= yes +.endif + +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +SHLIB_SHFLAGS+= -L ${DESTDIR}/usr/lib +SHLIB_SHFLAGS+= -Wl,-plugin=${GOLD_PLUGIN} \ + -Wl,-plugin-opt=-disable-opt + +SECTIONIFYPASS?=${NETBSDSRCDIR}/minix/llvm/bin/sectionify.so +# dcvmoole: the following construction is a hack for libmagicrt. For reasons +# not entirely under our control, clang refuses to take .bc objects even when +# using the gold linker, saying that LLVM IR code cannot be linked. In order +# to sidestep this, libmagicrt uses the name "foo.bc.o" instead of "foo.bc" to +# link the its LLVM IR objects. As all libmagicrt modules use the sectionify +# pass below, and this step needs temporary files, we give the temporary files +# the .o suffix (while anything would do!), and allow the libmagicrt makefile +# to override the rename to the real file name to perform a copy instead. As +# a result, libmagicrt ends up with both the .bc and .bc.o objects, and it can +# pass the latter set to clang, bypassing clang's overly strict checks. +SECTIONIFYMV?=mv -f + +.S.bc: ${.TARGET:.bc=.o} + rm -f ${.TARGET} + ln ${.TARGET:.bc=.o} ${.TARGET} +.c.bc: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -flto + if [ -n '${SECTIONIFY.${.IMPSRC:T}:U${SECTIONIFY}}' ]; then \ + ${OPT} -load ${SECTIONIFYPASS} -sectionify ${SECTIONIFY.${.IMPSRC:T}:U${SECTIONIFY}} -o ${.TARGET}.o ${.TARGET} && ${SECTIONIFYMV} ${.TARGET}.o ${.TARGET}; \ + fi + +.cc.bc .cxx.bc .cpp.bc: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} -flto +.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +.c.o: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.c.po: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.c.go: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET} + +.c.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPSHLIBOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.cc.o .cpp.o .cxx.o .C.o: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.cc.po .cpp.po .cxx.po .C.po: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.cc.go .cpp.go .cxx.go .C.go: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET} + +.cc.pico .cpp.pico .cxx.pico .C.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPSHLIBOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.f.o: + ${_MKTARGET_COMPILE} + ${COMPILE.f} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPFOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.f.po: + ${_MKTARGET_COMPILE} + ${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPFOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.f.go: + ${_MKTARGET_COMPILE} + ${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET} + +.f.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.f} ${PICFLAGS} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPFOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.f.ln: + ${_MKTARGET_COMPILE} + @echo Skipping lint for Fortran libraries. + +.m.o: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPOBJCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.m.po: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPOBJCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.m.go: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPOBJCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.m.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPOBJCOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.s.o: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.S.o: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.s.po: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.S.po: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.s.go: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} + +.S.go: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} + +.s.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +.S.pico: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} +.if defined(LIBSTRIPAOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +# Declare a few variables to make our life easier later. +_LIB:=${_LIB_PREFIX}${LIB} +_LIB.a:=${_LIB}.a +_LIB_p.a:=${_LIB}_p.a +_LIB_g.a:=${_LIB}_g.a +_LIB_pic.a:=${_LIB}_pic.a +_LIB.ln:=llib-l${LIB}.ln +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +_LIB_bc.a:=${_LIB}_bc.a +.endif # defined(__MINIX) + +.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) +_LIB.so:=${_LIB}.so +_LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR} +_LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION} +_LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link +.if ${MKDEBUG} != "no" +_LIB.so.debug:=${_LIB.so.full}.debug +.endif +.endif + +_DEST.LIB:=${DESTDIR}${LIBDIR} +_DEST.OBJ:=${DESTDIR}${_LIBSODIR} +_DEST.LINT:=${DESTDIR}${LINTLIBDIR} +_DEST.DEBUG:=${DESTDIR}${DEBUGDIR}${LIBDIR} +_DEST.ODEBUG:=${DESTDIR}${DEBUGDIR}${_LIBSODIR} + +.if defined(LIB) # { +.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \ + || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no" +_LIBS=${_LIB.a} +.else +_LIBS= +.endif + +.if ${LIBISPRIVATE} != "no" \ + && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \ + && !defined(NOCOMBINE)) # { +.for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g} +COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5} +.if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f) +COMBINESRCS+= ${f} +NODPSRCS+= ${f} +.else +OBJS+= ${f:R:S/$/.o/} +.endif +.endfor + +.if !empty(COMBINESRCS) +OBJS+= ${_LIB}_combine.o +${_LIB}_combine.o: ${COMBINESRCS} + ${_MKTARGET_COMPILE} + ${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET} +.if defined(LIBSTRIPOBJS) + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} +.endif + +CLEANFILES+= ${_LIB}_combine.d + +.if exists("${_LIB}_combine.d") +.include "${_LIB}_combine.d" +.endif +.endif # empty(XSRCS.${LIB}) +.else # } { +OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g} +.endif # } + +STOBJS+=${OBJS} + +LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} + +.if ${LIBISPRIVATE} != "no" +# No installation is required +libinstall:: +.endif + +.if ${MKDEBUGLIB} != "no" +_LIBS+=${_LIB_g.a} +GOBJS+=${OBJS:.o=.go} +DEBUGFLAGS?=-DDEBUG +.endif + +.if ${MKPROFILE} != "no" +_LIBS+=${_LIB_p.a} +POBJS+=${OBJS:.o=.po} +PROFFLAGS?=-DGPROF -DPROF +.endif + +.if ${MKPIC} != "no" # { +.if ${MKPICLIB} == "no" +.if ${MKSHLIBOBJS} != "no" +# make _pic.a, which isn't really pic, +# since it's needed for making shared lib. +# but don't install it. +SOLIB=${_LIB_pic.a} +SOBJS+=${OBJS:.o=.pico} +.else +SOLIB=${_LIB.a} +.endif +.else +SOLIB=${_LIB_pic.a} +_LIBS+=${SOLIB} +SOBJS+=${OBJS:.o=.pico} +.endif +.if defined(SHLIB_FULLVERSION) +_LIBS+=${_LIB.so.full} +.endif +.endif # } + +.if ${MKLINT} != "no" && !empty(LOBJS) +_LIBS+=${_LIB.ln} +.endif + +ALLOBJS= +.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \ + || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no" +ALLOBJS+=${STOBJS} +.endif +ALLOBJS+=${POBJS} ${SOBJS} +.if ${MKLINT} != "no" && !empty(LOBJS) +ALLOBJS+=${LOBJS} +.endif +.else # !defined(LIB) # } { +LOBJS= +SOBJS= +.endif # !defined(LIB) # } + +_YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}} + +.if ${USE_BITCODE:Uno} == "yes" +.if defined(LIB) +_LIBS+=${_LIB_bc.a} +.endif +.endif # ${USE_BITCODE:Uno} == "yes" + +.NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS} + +realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug} + +MKARZERO?= ${MKREPRO:Uno} + +.if ${MKARZERO} == "yes" +_ARFL=crsD +_ARRANFL=sD +_INSTRANLIB= +.else +_ARFL=crs +_ARRANFL=s +.if ${USE_BITCODE:Uno} == "yes" +_INSTRANLIB=${empty(PRESERVE):?-a "${AR} --plugin ${GOLD_PLUGIN} -s":} +.else +_INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":} +.endif # ${USE_BITCODE:Uno} == "yes" +.endif + +# If you change this, please consider reflecting the change in +# the override in sys/rump/Makefile.rump. +.if !target(__archivebuild) +__archivebuild: .USE + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` +.endif + +.if !target(__archiveinstall) +__archiveinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${_INSTRANLIB} ${.ALLSRC} ${.TARGET} +.endif + +__archivesymlinkpic: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET} + +DPSRCS+= ${_YLSRCS} +CLEANFILES+= ${_YLSRCS} + +${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS} + +.if ${USE_BITCODE:Uno} == "yes" + +.if !target(__archivebuildbc) +__archivebuildbc: .USE + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${AR} ${_ARFL} --plugin ${GOLD_PLUGIN} ${.TARGET} ${.ALLSRC:M*bc} +.endif + +# LSC: Ignore libunwind in the bitcode archive, otherwise final linking chokes +# on libunwind hidden assembly symbols. +BCOBJS+=${OBJS:Nlibunwind.*:.o=.bc} +ALLOBJS+=${BCOBJS} +${_LIB_bc.a}:: ${BCOBJS} __archivebuildbc + +.endif # ${USE_BITCODE:Uno} == "yes" + +${_LIB.a}:: ${STOBJS} __archivebuild + +${_LIB_p.a}:: ${POBJS} __archivebuild + +${_LIB_pic.a}:: ${SOBJS} __archivebuild + +${_LIB_g.a}:: ${GOBJS} __archivebuild + + +_LIBLDOPTS= +.if ${SHLIBDIR} != "/usr/lib" +_LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ + -L=${SHLIBDIR} +.elif ${SHLIBINSTALLDIR} != "/usr/lib" +_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ + -L=${SHLIBINSTALLDIR} +.endif + +# gcc -shared now adds -lc automatically. For libraries other than libc and +# libgcc* we add as a dependency the installed shared libc. For libc and +# libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that +# -Xl,-nostdlib is not enough because we want to tell the compiler-driver not +# to add standard libraries, not the linker. +.if !defined(LIB) +.if !empty(LIBC_SO) +DPLIBC ?= ${DESTDIR}${LIBC_SO} +.endif +.else +.if ${LIB} != "c" && ${LIB:Mgcc*} == "" \ + && ${LIB} != "sys" && ${LIB} != "minc" && ${LIB} != "mthread" # Minix-specific libs +.if !empty(LIBC_SO) +DPLIBC ?= ${DESTDIR}${LIBC_SO} +.endif +.else +LDLIBC ?= -nodefaultlibs +.if ${HAVE_LIBGCC} == "yes" && (${LIB} == "c" || ${LIB} == "minc") +.if !defined(__MINIX) +LDADD+= -lgcc +.else +LDADD+= ${${ACTIVE_CC} == "gcc":? -lgcc:} +.if ${MACHINE_ARCH} == "earm" +LDADD+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:} +.endif # ${MACHINE_ARCH} == "earm" +.endif # !defined(__MINIX) +.endif +.endif +.endif + +.if ${LIBISCXX} != "no" +LIBCC:= ${CXX} +. if ${MKLIBCXX} == "yes" +LIBDPLIBS+= c++ ${.CURDIR}/../../../../../external/bsd/libc++/lib +. else +LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3 +. endif +.else +LIBCC:= ${CC} +.endif + +_LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}} +_LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}} + +_MAINLIBDEPS= ${SOLIB} ${DPADD} ${DPLIBC} \ + ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} + +.if defined(_LIB.so.debug) +${_LIB.so.debug}: ${_LIB.so.link} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --only-keep-debug \ + ${_LIB.so.link} ${_LIB.so.debug} \ + ) || (rm -f ${.TARGET}; false) +${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ + --add-gnu-debuglink=${_LIB.so.debug} \ + ${_LIB.so.link} ${_LIB.so.full} \ + ) || (rm -f ${.TARGET}; false) +${_LIB.so.link}: ${_MAINLIBDEPS} +.else # aka no MKDEBUG +${_LIB.so.full}: ${_MAINLIBDEPS} +.endif + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \ + ${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \ + -Wl,--whole-archive ${SOLIB} \ + -Wl,--no-whole-archive ${_LDADD.${_LIB}} +# We don't use INSTALL_SYMLINK here because this is just +# happening inside the build directory/objdir. XXX Why does +# this spend so much effort on libraries that aren't live??? XXX +# XXX Also creates dead symlinks until the .full rule runs +# above and creates the main link +.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ + "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" + ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp + mv -f ${_LIB.so.major}.tmp ${_LIB.so.major} +.endif + ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp + mv -f ${_LIB.so}.tmp ${_LIB.so} +.if ${MKSTRIPIDENT} != "no" + ${OBJCOPY} -R .ident ${.TARGET} +.endif + +.if !empty(LOBJS) # { +LLIBS?= -lc +${_LIB.ln}: ${LOBJS} + ${_MKTARGET_COMPILE} + rm -f ${.TARGET} +.if defined(DESTDIR) + ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS} +.else + ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS} +.endif +.endif # } + +lint: ${LOBJS} +.if defined(LOBJS) && !empty(LOBJS) + ${LINT} ${LINTFLAGS} ${LOBJS} +.endif + + +# If the number of entries in CLEANFILES is too large, then the +# commands in bsd.clean.mk encounter errors like "exec(/bin/sh) +# failed (Argument list too long)". Avoid that by splitting the +# files to clean into several lists using different variable names. +# __cleanuse is an internal target in bsd.clean.mk; the way we +# use it here mimics the way it's used by the clean target in +# bsd.clean.mk. +# +clean: libclean1 libclean2 libclean3 libclean4 libclean5 +libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1 +libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2 +libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3 +libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4 +libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5 +.if defined(__MINIX) +# MINIX: core conflicts with core/ in lib/liblwip +CLEANFILES+= a.out [Ee]rrs mklog *.core +.else +CLEANFILES+= a.out [Ee]rrs mklog core *.core +.endif # defined(__MINIX) +LIBCLEANFILES1+= ${_LIB.a} ${STOBJS} ${STOBJS:=.tmp} +LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS} ${POBJS:=.tmp} +LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS} ${GOBJS:=.tmp} +LIBCLEANFILES4+= ${_LIB_pic.a} +.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) +LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug} +.endif +LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp} +LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS} + +.if defined(__MINIX) +clean: libclean6 +libclean6: .PHONY .MADE __cleanuse LIBCLEANFILES6 +LIBCLEANFILES6+= ${_LIB_bc.a} ${BCOBJS} ${BCOBJS:=.tmp} +.endif + +.if !target(libinstall) # { +# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no +libinstall:: + +.if ${USE_BITCODE:Uno} == "yes" +libinstall:: ${_DEST.LIB}/bc/${_LIB.a} +.PRECIOUS: ${_DEST.LIB}/bc/${_LIB.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB_bc.a}) +${_DEST.LIB}/bc/${_LIB.a}! .MADE +.endif +${_DEST.LIB}/bc/${_LIB.a}! ${_LIB_bc.a} __archiveinstall +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB_bc.a}) +${_DEST.LIB}/bc/${_LIB.a}: .MADE +.endif +${_DEST.LIB}/bc/${_LIB.a}: ${_LIB_bc.a} __archiveinstall +.endif +.endif # ${USE_BITCODE:Uno} == "yes" + +.if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no" +libinstall:: ${_DEST.LIB}/${_LIB.a} +.PRECIOUS: ${_DEST.LIB}/${_LIB.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB.a}) +${_DEST.LIB}/${_LIB.a}! .MADE +.endif +${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB.a}) +${_DEST.LIB}/${_LIB.a}: .MADE +.endif +${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall +.endif +.endif + +.if ${MKPROFILE} != "no" +libinstall:: ${_DEST.LIB}/${_LIB_p.a} +.PRECIOUS: ${_DEST.LIB}/${_LIB_p.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB_p.a}) +${_DEST.LIB}/${_LIB_p.a}! .MADE +.endif +${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB_p.a}) +${_DEST.LIB}/${_LIB_p.a}: .MADE +.endif +${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall +.endif +.endif + +.if ${MKDEBUGLIB} != "no" +libinstall:: ${_DEST.LIB}/${_LIB_g.a} +.PRECIOUS: ${_DEST.LIB}/${_LIB_g.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB_g.a}) +${_DEST.LIB}/${_LIB_g.a}! .MADE +.endif +${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall +.else +.if !defined(BUILD) && !make(all) && !make(${LIB_g.a}) +${_DEST.LIB}/${_LIB_g.a}: .MADE +.endif +${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall +.endif +.endif + +.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no" +libinstall:: ${_DEST.LIB}/${_LIB_pic.a} +.PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a}) +${_DEST.LIB}/${_LIB_pic.a}! .MADE +.endif +.if ${MKPICLIB} == "no" +${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic +.else +${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall +.endif +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a}) +${_DEST.LIB}/${_LIB_pic.a}: .MADE +.endif +.if ${MKPICLIB} == "no" +${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic +.else +${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall +.endif +.endif +.endif + +.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION) + +libinstall:: ${_DEST.OBJ}/${_LIB.so.full} +.PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB.so.full}) +${_DEST.OBJ}/${_LIB.so.full}! .MADE +.endif +${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full} +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB.so.full}) +${_DEST.OBJ}/${_LIB.so.full}: .MADE +.endif +${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full} +.endif + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.ALLSRC} ${.TARGET} +.if ${_LIBSODIR} != ${LIBDIR} + ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \ + ${_DEST.LIB}/${_LIB.so.full} +.endif +.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ + "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" + ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major} +.if ${_LIBSODIR} != ${LIBDIR} + ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \ + ${_DEST.LIB}/${_LIB.so.major} +.endif +.endif +.if ${MKLINKLIB} != "no" + ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so} +.if ${_LIBSODIR} != ${LIBDIR} + ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \ + ${_DEST.LIB}/${_LIB.so} +.endif +.endif +.endif + +.if defined(_LIB.so.debug) +libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug} +.PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug} + +${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug} + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \ + ${.ALLSRC} ${.TARGET} +.if ${_LIBSODIR} != ${LIBDIR} + ${INSTALL_SYMLINK} -l r ${_DEST.DEBUG}/${_LIB.so.debug} \ + ${_DEST.ODEBUG}/${_LIB.so.debug} +.endif +.endif + +.if ${MKLINT} != "no" && !empty(LOBJS) +libinstall:: ${_DEST.LINT}/${_LIB.ln} +.PRECIOUS: ${_DEST.LINT}/${_LIB.ln} + +.if ${MKUPDATE} == "no" +.if !defined(BUILD) && !make(all) && !make(${_LIB.ln}) +${_DEST.LINT}/${_LIB.ln}! .MADE +.endif +${_DEST.LINT}/${_LIB.ln}! ${_LIB.ln} +.else +.if !defined(BUILD) && !make(all) && !make(${_LIB.ln}) +${_DEST.LINT}/${_LIB.ln}: .MADE +.endif +${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln} +.endif + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.ALLSRC} ${_DEST.LINT} +.endif +.endif # !target(libinstall) # } + +##### Pull in related .mk logic +LINKSOWN?= ${LIBOWN} +LINKSGRP?= ${LIBGRP} +LINKSMODE?= ${LIBMODE} +.include +.include +.include +.include +.include +.include +.include +.include + +${TARGETS}: # ensure existence diff --git a/src/share/mk/ubix.links.mk b/src/share/mk/ubix.links.mk new file mode 100644 index 0000000..067236d --- /dev/null +++ b/src/share/mk/ubix.links.mk @@ -0,0 +1,96 @@ +# $NetBSD: bsd.links.mk,v 1.34 2009/04/10 16:16:12 apb Exp $ + +.include + +##### Basic targets +install: linksinstall + +##### Default values +LINKS?= +SYMLINKS?= +LINKSOWN?= ${BINOWN} +LINKSGRP?= ${BINGRP} +LINKSMODE?= ${NONBINMODE} + +__linkinstall: .USE + ${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_LINK} \ + -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \ + -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \ + -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \ + ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_LINK} \ + -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \ + -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \ + -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \ + ${.ALLSRC} ${.TARGET} + +##### Install rules +.PHONY: linksinstall +linksinstall:: realinstall +.if !empty(SYMLINKS) + @(set ${SYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; shift; \ + t=${DESTDIR}$$1; shift; \ + if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ + [ "$$l" = "$$ttarg" ]; then \ + continue ; \ + fi ; \ + ${_MKSHMSG_INSTALL} $$t; \ + ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ + done; ) +.endif + +.for _src _dst in ${LINKS} +_l:=${DESTDIR}${_src} +_t:=${DESTDIR}${_dst} + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${LINKS:tl:M${_dst:tl:Q}:[\#]} > 1 +${_t}! ${_l} __linkinstall +.else +${_t}: ${_l} __linkinstall +.endif + +linksinstall:: ${_t} +.PRECIOUS: ${_t} +.endfor + +configinstall: configlinksinstall +.PHONY: configlinksinstall +configlinksinstall:: configfilesinstall +.if !empty(CONFIGSYMLINKS) + @(set ${CONFIGSYMLINKS}; \ + while test $$# -ge 2; do \ + l=$$1; shift; \ + t=${DESTDIR}$$1; shift; \ + if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \ + [ "$$l" = "$$ttarg" ]; then \ + continue ; \ + fi ; \ + ${_MKSHMSG_INSTALL} $$t; \ + ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ + done; ) +.endif + +.for _src _dst in ${CONFIGLINKS} +_l:=${DESTDIR}${_src} +_t:=${DESTDIR}${_dst} + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${CONFIGLINKS:tl:M${_dst:tl:Q}:[\#]} > 1 +${_t}! ${_l} __linkinstall +.else +${_t}: ${_l} __linkinstall +.endif + +configlinksinstall:: ${_t} +.PRECIOUS: ${_t} +.endfor + +.include diff --git a/src/share/mk/ubix.lua.mk b/src/share/mk/ubix.lua.mk new file mode 100644 index 0000000..cf33880 --- /dev/null +++ b/src/share/mk/ubix.lua.mk @@ -0,0 +1,173 @@ +# $NetBSD: bsd.lua.mk,v 1.7 2014/07/19 18:38:34 lneto Exp $ +# +# Build rules and definitions for Lua modules + +# +# Variables used +# +# LUA_VERSION currently installed version of Lua +# LUA_LIBDIR ${LIBDIR}/lua/${LUA_VERSION} +# +# LUA_MODULES list of Lua modules to build/installi +# LUA_DPLIBS shared library dependencies as per LIBDPLIBS +# +# LUA_SRCS.mod sources for each module (by default: "${mod:S/./_/g}.lua") +# +# DPADD additional dependencies for building modules +# DPADD.mod additional dependencies for a specific module +# +# +# HAVE_LUAC if defined, .lua source files will be compiled with ${LUAC} +# and installed as precompiled chunks for faster loading. Note +# that the luac file format is not yet standardised and may be +# subject to change. +# +# LUAC the luac compiler (by default: /usr/bin/luac) +# +# +# Notes: +# +# currently make(depend) and make(tags) do not support .lua sources; We +# add Lua sources to DPSRCS when HAVE_LUAC is defined and other language +# sources to SRCS for . +# +# other language support for other than C is incomplete +# +# C language sources are passed though lint, when MKLINT != "no" +# +# The Lua binary searches /usr/share/lua/5.1/ at this time and we could +# install .lua modules there which would mean slightly less duplication +# in compat builds. However, MKSHARE=no would prevent such modules from +# being installed so we just install everything under /usr/lib/lua/5.1/ +# + +.if !defined(_BSD_LUA_MK_) +_BSD_LUA_MK_=1 + +.include +.include +.include + +#__MINIX: Not always included +.include +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +LDFLAGS+= -L${DESTDIR}/usr/lib +.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" + +## +##### Basic targets +realinstall: .PHONY lua-install +realall: .PHONY lua-all +lint: .PHONY lua-lint + +lua-install: .PHONY + +lua-all: .PHONY + +lua-lint: .PHONY + +CLEANFILES+= a.out [Ee]rrs mklog core *.core + +## +##### Global variables +LUA_VERSION?= 5.3 +LUA_LIBDIR?= ${LIBDIR}/lua/${LUA_VERSION} +LUAC?= /usr/bin/luac + +## +##### Build rules + +# XX should these always be on? +CFLAGS+= -fPIC + +.SUFFIXES: .lua .luac +.lua.luac: + ${_MKTARGET_COMPILE} + ${LUAC} -o ${.TARGET} ${.IMPSRC} + +## +##### Libraries that modules may depend upon. +.for _lib _dir in ${LUA_DPLIBS} +.if !defined(LIBDO.${_lib}) +LIBDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} +.MAKEOVERRIDES+=LIBDO.${_lib} +.endif +LDADD+=-L${LIBDO.${_lib}} -l${_lib} +DPADD+=${LIBDO.${_lib}}/lib${_lib}.so +.endfor + +## +##### Lua Modules +.for _M in ${LUA_MODULES} +LUA_SRCS.${_M}?=${_M:S/./_/g}.lua +LUA_DEST.${_M}=${LUA_LIBDIR}${_M:S/./\//g:S/^/\//:H} + +.if !empty(LUA_SRCS.${_M}:M*.lua) +.if ${LUA_SRCS.${_M}:[\#]} > 1 +.error Module "${_M}" has too many source files +.endif +.if defined(HAVE_LUAC) +## +## The module has Lua source and needs to be compiled +LUA_TARG.${_M}=${_M:S/./_/g}.luac +LUA_NAME.${_M}=${_M:S/./\//g:T}.luac +CLEANFILES+=${LUA_TARG.${_M}} +DPSRCS+=${LUA_SRCS.${_M}} + +.NOPATH: ${LUA_TARG.${_M}} +lua-all: ${LUA_TARG.${_M}} +${LUA_TARG.${_M}}: ${LUA_SRCS.${_M}} ${DPADD} ${DPADD.${_M}} +.else +## +## The module has Lua source and can be installed directly +LUA_TARG.${_M}=${LUA_SRCS.${_M}} +LUA_NAME.${_M}=${_M:S/./\//g:T}.lua +.endif +.else +## +## The module has other language source and we must build ${_M}.so +LUA_OBJS.${_M}=${LUA_SRCS.${_M}:N*.lua:R:S/$/.o/g} +LUA_LOBJ.${_M}=${LUA_SRCS.${_M}:M*.c:.c=.ln} +LUA_TARG.${_M}=${_M:S/./_/g}.so +LUA_NAME.${_M}=${_M:S/./\//g:T}.so +CLEANFILES+=${LUA_OBJS.${_M}} ${LUA_LOBJ.${_M}} ${LUA_TARG.${_M}} +DPSRCS+=${LUA_SRCS.${_M}} +SRCS+=${LUA_SRCS.${_M}} + +.NOPATH: ${LUA_OBJS.${_M}} ${LUA_LOBJ.${_M}} ${LUA_TARG.${_M}} +.if ${MKLINT} != "no" +${LUA_TARG.${_M}}: ${LUA_LOBJ.${_M}} +.endif +lua-lint: ${LUA_LOBJ.${_M}} +lua-all: ${LUA_TARG.${_M}} +${LUA_TARG.${_M}}: ${LUA_OBJS.${_M}} ${DPADD} ${DPADD.${_M}} + ${_MKTARGET_BUILD} + rm -f ${.TARGET} + ${CC} -Wl,--warn-shared-textrel \ + -Wl,-x -shared ${LUA_OBJS.${_M}} \ + -Wl,-soname,${LUA_NAME.${_M}} -o ${.TARGET} \ + ${LDADD} ${LDADD.${_M}} ${LDFLAGS} ${LDFLAGS.${_M}} + +.endif + +DPADD+= ${LIBLUA} +LDADD+= -llua + +## +## module install rules +lua-install: ${DESTDIR}${LUA_DEST.${_M}}/${LUA_NAME.${_M}} +${DESTDIR}${LUA_DEST.${_M}}/${LUA_NAME.${_M}}! ${LUA_TARG.${_M}} + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.ALLSRC} ${.TARGET} + +.endfor +## +##### end of modules + +.include +.include +.include +.include +.include +.endif # ! defined(_BSD_LUA_MK_) diff --git a/src/share/mk/ubix.man.mk b/src/share/mk/ubix.man.mk new file mode 100644 index 0000000..0e557ef --- /dev/null +++ b/src/share/mk/ubix.man.mk @@ -0,0 +1,302 @@ +# $NetBSD: bsd.man.mk,v 1.117 2014/12/19 22:25:39 christos Exp $ +# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93 + +.include + +##### Basic targets +.PHONY: catinstall maninstall catpages manpages catlinks manlinks +.PHONY: htmlinstall htmlpages htmllinks +.PHONY: lintmanpages +realinstall: ${MANINSTALL} + +# If our install destination is case-preserving, but case-insensitive +# then we do filesystem comparisons in lower case to make sure that +# we always refresh the target when needed. In general we don't +# want to do this, otherwise things like _exit.2 -> _Exit.2 get +# installed on each build even when they don't need to. Note that +# the CASE_INSENSITIVE_DEST macro is currently not defined anywhere, +# and the expansion does not really work because of make(1). +.if defined(CASE_INSENSITIVE_DEST) +_FLATTEN?=tl: +.endif + +##### Default values +.if ${USETOOLS} == "yes" +TMACDEPDIR?= ${TOOLDIR}/share/groff/tmac +.else +TMACDEPDIR?= /usr/share/tmac +.endif + +HTMLDIR?= ${DESTDIR}${MANDIR} +.if ${MKMANDOC} == yes && !defined(NOMANDOC) +CATDEPS?= +.else +CATDEPS?= ${TMACDEPDIR}/andoc.tmac \ + ${TMACDEPDIR}/doc.tmac \ + ${TMACDEPDIR}/mdoc/doc-common \ + ${TMACDEPDIR}/mdoc/doc-ditroff \ + ${TMACDEPDIR}/mdoc/doc-nroff \ + ${TMACDEPDIR}/mdoc/doc-syms +.endif +MANTARGET?= cat + +MAN?= +MLINKS?= +_MSECTIONS= 1 2 3 4 5 6 7 8 9 +_MSECTIONS+= 3lua 9lua +_MSECTIONREGEX= ${_MSECTIONS:ts|} # e.g. 1|2|3|... +.SUFFIXES: ${_MSECTIONS:@N@.$N@} + +.if ${MKMANZ} == "no" +MANCOMPRESS?= +MANSUFFIX?= +.else +MANCOMPRESS?= ${TOOL_GZIP_N} -cf +MANSUFFIX?= .gz +.endif + +# make MANCOMPRESS a filter, so it can be inserted on an as-needed basis +.if !empty(MANCOMPRESS) +MANCOMPRESS:= | ${MANCOMPRESS} +.endif + +__installpage: .USE + @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \ + (${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ + ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_FILE} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ + ${.ALLSRC} ${.TARGET}) + +# XXX consider including bsd.links.mk and using __linkinstall instead +__linkinstallpage: .USE + ${_MKSHMSG_INSTALL} ${.TARGET}; \ + ${_MKSHECHO} "${INSTALL_LINK} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ + ${.ALLSRC} ${.TARGET}" && \ + ${INSTALL_LINK} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ + ${.ALLSRC} ${.TARGET} + +##### Build and install rules (source form pages) + +.if ${MKMAN} != "no" +maninstall: manpages manlinks +manpages:: # ensure target exists +MANPAGES= ${MAN:C/.$/&${MANSUFFIX}/} + +realall: ${MANPAGES} +.if !empty(MANSUFFIX) +.NOPATH: ${MANPAGES} +.SUFFIXES: ${_MSECTIONS:@N@.$N${MANSUFFIX}@} + +${_MSECTIONS:@N@.$N.$N${MANSUFFIX}@}: # build rule + ${_MKTARGET_FORMAT} + cat ${.IMPSRC} ${MANCOMPRESS} > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.endif # !empty(MANSUFFIX) + +.for F in ${MANPAGES:S/${MANSUFFIX}$//:O:u} +_F:= ${DESTDIR}${MANDIR}/man${F:T:E}${MANSUBDIR}/${F}${MANSUFFIX} + +.if ${MKUPDATE} == "no" +${_F}! ${F}${MANSUFFIX} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F}${MANSUFFIX} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +manpages:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +manlinks:: # link install + +.for _src _dst in ${MLINKS} +_l:=${DESTDIR}${MANDIR}/man${_src:T:E}${MANSUBDIR}/${_src}${MANSUFFIX} +_t:=${DESTDIR}${MANDIR}/man${_dst:T:E}${MANSUBDIR}/${_dst}${MANSUFFIX} + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${MLINKS:${_FLATTEN}M${_dst:${_FLATTEN}Q}:[\#]} > 1 +${_t}! ${_l} __linkinstallpage +.else +${_t}: ${_l} __linkinstallpage +.endif + +manlinks:: ${_t} +.PRECIOUS: ${_t} +.endfor +.endif # ${MKMAN} != "no" + +##### Build and install rules (plaintext pages) + +.if (${MKCATPAGES} != "no") && (${MKMAN} != "no") +catinstall: catpages catlinks +catpages:: # ensure target exists +CATPAGES= ${MAN:C/\.(${_MSECTIONREGEX})\$/.cat\1${MANSUFFIX}/} + +realall: ${CATPAGES} +.NOPATH: ${CATPAGES} +.SUFFIXES: ${_MSECTIONS:@N@.cat$N${MANSUFFIX}@} +.MADE: ${CATDEPS} + +${_MSECTIONS:@N@.$N.cat$N${MANSUFFIX}@}: ${CATDEPS} # build rule + ${_MKTARGET_FORMAT} +.if ${MKMANDOC} == yes && !defined(NOMANDOC) + if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \ + ${TOOL_MANDOC_ASCII} ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \ + else \ + ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \ + fi +.elif defined(USETBL) + ${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_ASCII} -mandoc ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.else + ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.endif + +.for F in ${CATPAGES:S/${MANSUFFIX}$//:O:u} +_F:= ${DESTDIR}${MANDIR}/${F:T:E}${MANSUBDIR}/${F:R}.0${MANSUFFIX} + +.if ${MKUPDATE} == "no" +${_F}! ${F}${MANSUFFIX} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F}${MANSUFFIX} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +catpages:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +catlinks:: # link install + +.for _src _dst in ${MLINKS} +_l:=${DESTDIR}${MANDIR}/cat${_src:T:E}${MANSUBDIR}/${_src:R}.0${MANSUFFIX} +_t:=${DESTDIR}${MANDIR}/cat${_dst:T:E}${MANSUBDIR}/${_dst:R}.0${MANSUFFIX} + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${MLINKS:${_FLATTEN}M${_dst:${_FLATTEN}Q}:[\#]} > 1 +${_t}! ${_l} __linkinstallpage +.else +${_t}: ${_l} __linkinstallpage +.endif + +catlinks:: ${_t} +.PRECIOUS: ${_t} +.endfor +.endif # (${MKCATPAGES} != "no") && (${MKMAN} != "no") + +##### Build and install rules (HTML pages) + +.if (${MKHTML} != "no") && (${MKMAN} != "no") # { +htmlinstall: htmlpages htmllinks +htmlpages:: # ensure target exists +HTMLPAGES= ${MAN:C/\.(${_MSECTIONREGEX})\$/.html\1/} + +HTMLLINKS= ${MANSUBDIR:?../:}../html%S/%N.html +HTMLSTYLE= ${MANSUBDIR:?../:}../style.css + +realall: ${HTMLPAGES} +.NOPATH: ${HTMLPAGES} +.SUFFIXES: ${_MSECTIONS:@N@.html$N@} + +${_MSECTIONS:@N@.$N.html$N@}: # build rule + ${_MKTARGET_FORMAT} +.if ${MKMANDOC} == yes && !defined(NOMANDOC) + if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \ + ${TOOL_MANDOC_HTML} -Oman=${HTMLLINKS} -Ostyle=${HTMLSTYLE} \ + ${.IMPSRC} > ${.TARGET}.tmp && \ + mv ${.TARGET}.tmp ${.TARGET}; \ + else \ + ${TOOL_ROFF_HTML} ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \ + fi +.elif defined(USETBL) + ${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_HTML} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.else + ${TOOL_ROFF_HTML} ${.IMPSRC} ${MANCOMPRESS} \ + > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET} +.endif + +.for F in ${HTMLPAGES:O:u} +# construct installed path +_F:= ${HTMLDIR}/${F:T:E}${MANSUBDIR}/${F:R:S-/index$-/x&-}.html + +.if ${MKUPDATE} == "no" +${_F}! ${F} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __installpage # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +htmlpages:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +htmllinks:: # link install + +.for _src _dst in ${MLINKS} +_l:=${HTMLDIR}/html${_src:T:E}${MANSUBDIR}/${_src:R:S-/index$-/x&-}.html +_t:=${HTMLDIR}/html${_dst:T:E}${MANSUBDIR}/${_dst:R:S-/index$-/x&-}.html + +# Handle case conflicts carefully, when _dst occurs +# more than once after case flattening +.if ${MKUPDATE} == "no" || ${MLINKS:${_FLATTEN}M${_dst:${_FLATTEN}Q}:[\#]} > 1 +${_t}! ${_l} __linkinstallpage +.else +${_t}: ${_l} __linkinstallpage +.endif + +htmllinks:: ${_t} +.PRECIOUS: ${_t} +.endfor + +.endif # } + +##### Clean rules +.undef _F + +.if !empty(MAN) && (${MKMAN} != "no") +.if (${MKCATPAGES} != "no") +CLEANDIRFILES+= ${CATPAGES} +.endif +.if !empty(MANSUFFIX) +CLEANDIRFILES+= ${MANPAGES} ${CATPAGES:S/${MANSUFFIX}$//} +.endif +.if ${MKHTML} != "no" +CLEANDIRFILES+= ${HTMLPAGES} +.endif +.endif +# (XXX ${CATPAGES:S...} cleans up old .catN files where .catN.gz now used) + +.if !empty(MANPAGES) +lintmanpages: ${MANPAGES} + ${TOOL_MANDOC_LINT} -Tlint -fstrict -Wall,stop ${.ALLSRC} +.endif + +##### Pull in related .mk logic +.include +.include +.include +.include + +${TARGETS} catinstall maninstall htmlinstall: # ensure existence diff --git a/src/share/mk/ubix.nls.mk b/src/share/mk/ubix.nls.mk new file mode 100644 index 0000000..0fefdbe --- /dev/null +++ b/src/share/mk/ubix.nls.mk @@ -0,0 +1,71 @@ +# $NetBSD: bsd.nls.mk,v 1.47 2011/09/10 16:57:35 apb Exp $ + +.include + +##### Basic targets +realinstall: nlsinstall + +##### Default values +NLSNAME?= ${PROG:Ulib${LIB}} + +NLS?= + +##### Build rules +.if ${MKNLS} != "no" + +NLSALL= ${NLS:.msg=.cat} + +realall: ${NLSALL} +.NOPATH: ${NLSALL} + +.SUFFIXES: .cat .msg + +.msg.cat: + @rm -f ${.TARGET} + ${_MKTARGET_CREATE} + ${TOOL_GENCAT} ${.TARGET} ${.IMPSRC} + +.endif # ${MKNLS} != "no" + +##### Install rules +nlsinstall:: # ensure existence +.PHONY: nlsinstall + +.if ${MKNLS} != "no" + +__nlsinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} \ + ${.ALLSRC} ${.TARGET} + +.for F in ${NLSALL:O:u} +_F:= ${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat # installed path + +.if ${MKUPDATE} == "no" +${_F}! ${F} __nlsinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}! .MADE # no build at install +.endif +.else +${_F}: ${F} __nlsinstall # install rule +.if !defined(BUILD) && !make(all) && !make(${F}) +${_F}: .MADE # no build at install +.endif +.endif + +nlsinstall:: ${_F} +.PRECIOUS: ${_F} # keep if install fails +.endfor + +.undef _F +.endif # ${MKNLS} != "no" + +##### Clean rules +.if ${MKNLS} != "no" && !empty(NLS) +CLEANDIRFILES+= ${NLSALL} +.endif + +##### Pull in related .mk logic +.include +.include +.include diff --git a/src/share/mk/ubix.obj.mk b/src/share/mk/ubix.obj.mk new file mode 100644 index 0000000..fb141d0 --- /dev/null +++ b/src/share/mk/ubix.obj.mk @@ -0,0 +1,109 @@ +# $NetBSD: bsd.obj.mk,v 1.49 2010/01/25 00:43:00 christos Exp $ + +.if !defined(_BSD_OBJ_MK_) +_BSD_OBJ_MK_=1 + +.include + +__curdir:= ${.CURDIR} + +.if ${MKOBJ} == "no" +obj: +.else +.if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR) +.if defined(MAKEOBJDIRPREFIX) +__objdir:= ${MAKEOBJDIRPREFIX}${__curdir} +.else +__objdir:= ${MAKEOBJDIR} +.endif +# MAKEOBJDIR and MAKEOBJDIRPREFIX are env variables supported +# by make(1). We simply mkdir -p the specified path. +# If that fails - we do a mkdir to get the appropriate error message +# before bailing out. +obj: +.if defined(MAKEOBJDIRPREFIX) + @if [ ! -d ${MAKEOBJDIRPREFIX} ]; then \ + echo "MAKEOBJDIRPREFIX ${MAKEOBJDIRPREFIX} does not exist, bailing..."; \ + exit 1; \ + fi; +.endif + @if [ ! -d ${__objdir} ]; then \ + mkdir -p ${__objdir}; \ + if [ ! -d ${__objdir} ]; then \ + mkdir ${__objdir}; exit 1; \ + fi; \ + ${_MKSHMSG} " objdir ${__objdir}"; \ + fi +.else +PAWD?= /bin/pwd + +__objdir= obj${OBJMACHINE:D.${MACHINE}} + +__usrobjdir= ${BSDOBJDIR}${USR_OBJMACHINE:D.${MACHINE}} +__usrobjdirpf= ${USR_OBJMACHINE:D:U${OBJMACHINE:D.${MACHINE}}} + +.if defined(BUILDID) +__objdir:= ${__objdir}.${BUILDID} +__usrobjdirpf:= ${__usrobjdirpf}.${BUILDID} +__need_objdir_target=yes +.endif + +.if defined(OBJHOSTMACHINE) && (${MKHOSTOBJ:Uno} != "no") +# In case .CURDIR has been twiddled by a .mk file and is now relative, +# make it absolute again. +.if ${__curdir:M/*} == "" +__curdir!= cd "${__curdir}" && ${PAWD} +.endif + +__objdir:= ${__objdir}.${HOST_OSTYPE} +__usrobjdirpf:= ${__usrobjdirpf}.${HOST_OSTYPE} +__need_objdir_target=yes +.endif + +.if defined(__need_objdir_target) +# Get make to change its internal definition of .OBJDIR +.OBJDIR: ${__objdir} +.endif + +obj: + @cd "${__curdir}"; \ + here=`${PAWD}`/; subdir=$${here#${BSDSRCDIR}/}; \ + if [ "$$here" != "$$subdir" ]; then \ + if [ ! -d ${__usrobjdir} ]; then \ + echo "BSDOBJDIR ${__usrobjdir} does not exist, bailing..."; \ + exit 1; \ + fi; \ + subdir=$${subdir%/}; \ + dest=${__usrobjdir}/$$subdir${__usrobjdirpf}; \ + if [ -x ${TOOL_STAT} ] && \ + ttarg=`${TOOL_STAT} -qf '%Y' $${here}${__objdir}` && \ + [ "$$dest" = "$$ttarg" ]; then \ + : ; \ + else \ + ${_MKSHMSG} " objdir $$dest"; \ + rm -rf ${__objdir}; \ + ln -s $$dest ${__objdir}; \ + fi; \ + if [ ! -d $$dest ]; then \ + mkdir -p $$dest; \ + else \ + true; \ + fi; \ + else \ + true ; \ + dest=$${here}${__objdir} ; \ + if [ ! -d ${__objdir} ] || [ -h ${__objdir} ]; then \ + ${_MKSHMSG} " objdir $$dest"; \ + rm -f ${__objdir}; \ + mkdir $$dest; \ + fi ; \ + fi; +.endif +.endif + +print-objdir: + @echo ${.OBJDIR} + +.include + +.endif # !defined(_BSD_OBJ_MK_) diff --git a/src/share/mk/ubix.own.mk b/src/share/mk/ubix.own.mk index 65818c0..f76d5f8 100644 --- a/src/share/mk/ubix.own.mk +++ b/src/share/mk/ubix.own.mk @@ -368,7 +368,7 @@ # # Host platform information; may be overridden # -.include +.include .if ${USETOOLS} == "yes" # { @@ -1488,6 +1488,17 @@ .endif .endfor +#MINIX-specific vars +.for var in \ + USE_WATCHDOG USE_ACPI USE_PAE USE_APIC USE_DEBUGREG USE_SYSDEBUG \ + USE_LIVEUPDATE USE_PCI USE_BITCODE USE_MAGIC USE_ASR +.if (${${var:S/USE_/MK/}} == "no") +${var}:= no +.else +${var}?= yes +.endif +.endfor + # # USE_* options which default to "yes". # diff --git a/src/share/mk/ubix.prog.mk b/src/share/mk/ubix.prog.mk index 16c74de..ce10cf5 100644 --- a/src/share/mk/ubix.prog.mk +++ b/src/share/mk/ubix.prog.mk @@ -1,76 +1,789 @@ -# $NetBSD: bsd.host.mk,v 1.2 2014/04/10 19:02:18 plunky Exp $ +# $NetBSD: bsd.prog.mk,v 1.292 2015/06/07 15:04:28 matt Exp $ +# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 -.if !defined(_BSD_HOST_MK_) -_BSD_HOST_MK_=1 +.ifndef HOSTPROG -.if ${HOST_OSTYPE:C/\-.*//:U} == "Minix" -HOST_LDFLAGS?= -static +.include +.include +.include +.include -#LSC: Be a bit smarter about the default compiler -.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) -HOST_CC?= clang -.endif +# +# Definitions and targets shared among all programs built by a single +# Makefile. +# -.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) -HOST_CC?= gcc -.endif -.endif # ${HOST_OSTYPE:C/\-.*//:U} == "Minix" +##### Basic targets +realinstall: proginstall scriptsinstall -# Helpers for cross-compiling -HOST_CC?= cc -HOST_CFLAGS?= -O -HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c -HOST_COMPILE.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} -c -HOST_LINK.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} -.if defined(HOSTPROG_CXX) -HOST_LINK.c?= ${HOST_LINK.cc} +.gdbinit: + rm -f .gdbinit +.if defined(DESTDIR) && !empty(DESTDIR) + echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit .else -HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} + touch .gdbinit +.endif +.for __gdbinit in ${GDBINIT} + echo "source ${__gdbinit}" >> .gdbinit +.endfor + +CLEANFILES+= a.out [Ee]rrs mklog core *.core .gdbinit + +.if defined(SHAREDSTRINGS) +CLEANFILES+=strings +.c.o: + ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c - + @${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + @rm -f x.c + +.cc.o .cpp.o .cxx.o .C.o: + ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c - + @mv -f x.c x.cc + @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + @rm -f x.cc .endif -HOST_CXX?= c++ -HOST_CXXFLAGS?= -O - -HOST_CPP?= cpp -HOST_CPPFLAGS?= - -HOST_LD?= ld -HOST_LDFLAGS?= - -HOST_AR?= ar -HOST_RANLIB?= ranlib - -HOST_LN?= ln - -# HOST_SH must be an absolute path -HOST_SH?= /bin/sh - -.if !defined(HOST_OSTYPE) -_HOST_OSNAME!= uname -s -_HOST_OSREL!= uname -r -# For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints -# something that does not look like an identifier, then use uname -m. -_HOST_ARCH!= uname -p 2>/dev/null -_HOST_ARCH:= ${HOST_ARCH:tW:C/.*[^-_A-Za-z0-9].*//:S/unknown//} -.if empty(_HOST_ARCH) -_HOST_ARCH!= uname -m +.if defined(MKPIE) && (${MKPIE} != "no") +CFLAGS+= ${PIE_CFLAGS} +AFLAGS+= ${PIE_AFLAGS} +LDFLAGS+= ${PIE_LDFLAGS} .endif -HOST_OSTYPE:= ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g} -.MAKEOVERRIDES+= HOST_OSTYPE -.endif # !defined(HOST_OSTYPE) -.if ${USERTOOLS} == "yes" -HOST_MKDEP?= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep -HOST_MKDEPCXX?= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep +CFLAGS+= ${COPTS} +.if defined(MKDEBUG) && (${MKDEBUG} != "no") +CFLAGS+= -g +.endif +OBJCFLAGS+= ${OBJCOPTS} +MKDEP_SUFFIXES?= .o .ln .d + +# CTF preserve debug symbols +.if (${MKCTF:Uno} != "no") && (${CFLAGS:M-g} != "") +CTFFLAGS+= -g +CTFMFLAGS+= -g +.if defined(HAVE_GCC) && ${HAVE_GCC} >= 48 +#CFLAGS+=-gdwarf-2 +.endif +.endif + +# ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o +.ifndef LIBCRTBEGIN +LIBCRTBEGIN= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o ${_GCC_CRTBEGIN} +.MADE: ${LIBCRTBEGIN} +.endif +.ifndef LIBCRTEND +LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtn.o +.MADE: ${LIBCRTEND} +.endif +_SHLINKER= ${SHLINKDIR}/ld.elf_so + +.ifndef LIBCRT0 +LIBCRT0= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crt0.o +.MADE: ${LIBCRT0} +.endif + +.ifndef LIBCRTI +LIBCRTI= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o +.MADE: ${LIBCRTI} +.endif + +##### Installed system library definitions +# +# E.g. +# LIBC?=${DESTDIR}/usr/lib/libc.a +# LIBX11?=${DESTDIR}/usr/X11R7/lib/libX11.a +# etc.. +# NB: If you are a library here, add it in bsd.README + +.for _lib in \ + archive \ + asn1 \ + atf_c \ + atf_cxx \ + bind9 \ + bluetooth \ + bsdmalloc \ + bz2 \ + c \ + c_pic \ + com_err \ + compat \ + crypt \ + crypto \ + crypto_idea \ + crypto_mdc2 \ + crypto_rc5 \ + curses \ + dbm \ + des \ + dns \ + edit \ + event \ + expat \ + fetch \ + fl \ + form \ + g2c \ + gcc \ + gnumalloc \ + gssapi \ + hdb \ + heimbase \ + heimntlm \ + hx509 \ + intl \ + ipsec \ + isc \ + isccc \ + isccfg \ + kadm5clnt \ + kadm5srv \ + kafs \ + krb5 \ + kvm \ + l \ + lber \ + ldap \ + ldap_r \ + lua \ + lwres \ + m \ + magic \ + menu \ + objc \ + ossaudio \ + pam \ + pcap \ + pci \ + pmc \ + posix \ + pthread \ + pthread_dbg \ + puffs \ + quota \ + radius \ + resolv \ + rmt \ + roken \ + rpcsvc \ + rt \ + rump \ + rumpfs_cd9660fs \ + rumpfs_efs \ + rumpfs_ext2fs \ + rumpfs_ffs \ + rumpfs_hfs \ + rumpfs_lfs \ + rumpfs_msdosfs \ + rumpfs_nfs \ + rumpfs_ntfs \ + rumpfs_syspuffs \ + rumpfs_tmpfs \ + rumpfs_udf \ + rumpfs_ufs \ + rumpuser \ + saslc \ + skey \ + sl \ + sqlite3 \ + ss \ + ssh \ + ssl \ + ssp \ + stdcxx \ + supcxx \ + terminfo \ + tre \ + usbhid \ + util \ + wind \ + wrap \ + y \ + z + +.ifndef LIB${_lib:tu} +LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a +.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded +.endif +.endfor + +# Minix libraries +.for _lib in \ + audiodriver \ + bdev \ + blockdriver \ + chardriver \ + clkconf \ + ddekit \ + ddekit_usb_client \ + ddekit_usb_server \ + devman \ + elf \ + exec \ + fsdriver \ + gpio \ + hgfs \ + i2cdriver \ + inputdriver \ + lwip \ + minc \ + minixfs \ + mthread \ + netdriver \ + sffs \ + sockdriver \ + sockevent \ + sys \ + timers \ + usb \ + vboxfs \ + virtio \ + vtreefs +.ifndef LIB${_lib:tu} +LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a +.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded +.endif +.endfor + +# PAM applications, if linked statically, need more libraries +.if (${MKPIC} == "no") +.if (${MKCRYPTO} != "no") +PAM_STATIC_LDADD+= -lssh +PAM_STATIC_DPADD+= ${LIBSSH} +.endif +.if (${MKKERBEROS} != "no") +PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \ + -lroken -lcom_err -lheimbase -lcrypto +PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \ + ${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO} +.endif +.if (${MKSKEY} != "no") +PAM_STATIC_LDADD+= -lskey +PAM_STATIC_DPADD+= ${LIBSKEY} +.endif +PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil +PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL} .else -HOST_MKDEP?= CC=${HOST_CC:Q} mkdep -HOST_MKDEPCXX?= CC=${HOST_CXX:Q} mkdep +PAM_STATIC_LDADD= +PAM_STATIC_DPADD= .endif -.if ${NEED_OWN_INSTALL_TARGET} != "no" -HOST_INSTALL_FILE?= ${INSTALL} ${COPY} ${PRESERVE} ${RENAME} -HOST_INSTALL_DIR?= ${INSTALL} -d -HOST_INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK} ${RENAME} +.if defined(__MINIX) && ${MACHINE_ARCH} == "earm" +# LSC: On ARM, when compiling statically, with gcc, lgcc_eh is required +LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:} +.endif # defined(__MINIX) && ${MACHINE_ARCH} == "earm" + +# NB: If you are a library here, add it in bsd.README +.for _lib in \ + FS \ + GL \ + GLU \ + ICE \ + SM \ + X11 \ + XTrap \ + Xau \ + Xaw \ + Xdmcp \ + Xext \ + Xfont \ + Xft \ + Xi \ + Xinerama \ + Xmu \ + Xmuu \ + Xpm \ + Xrandr \ + Xrender \ + Xss \ + Xt \ + Xtst \ + Xv \ + Xxf86dga \ + Xxf86misc \ + Xxf86vm \ + dps \ + fntstubs \ + fontcache \ + fontconfig \ + fontenc \ + freetype \ + lbxutil \ + xkbfile +.ifndef LIB${_lib:tu} +LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a +.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded +.endif +.endfor + +# Ugly one-offs +LIBX11_XCB= ${DESTDIR}${X11USRLIBDIR}/libX11-xcb.a +LIBXCB= ${DESTDIR}${X11USRLIBDIR}/libxcb.a + +.if defined(RESCUEDIR) +CPPFLAGS+= -DRESCUEDIR=\"${RESCUEDIR}\" .endif +_PROGLDOPTS= +.if ${SHLINKDIR} != "/usr/libexec" # XXX: change or remove if ld.so moves +_PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER} .endif +.if ${SHLIBDIR} != "/usr/lib" +_PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ + -L=${SHLIBDIR} +.elif ${SHLIBINSTALLDIR} != "/usr/lib" +_PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ + -L=${SHLIBINSTALLDIR} +.endif + +__proginstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${STRIPFLAG} ${.ALLSRC} ${.TARGET} + +__progrumpinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${RUMPBINOWN} -g ${RUMPBINGRP} -m ${RUMPBINMODE} \ + ${STRIPFLAG} ${.ALLSRC} ${.TARGET} + +__progdebuginstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \ + ${.ALLSRC} ${.TARGET} + + + +# +# Backwards compatibility with Makefiles that assume that bsd.prog.mk +# can only build a single binary. +# + +_APPEND_MANS=yes +_APPEND_SRCS=yes + +_CCLINKFLAGS= + +.if defined(PROG_CXX) +PROG= ${PROG_CXX} +_CCLINK= ${CXX} ${_CCLINKFLAGS} + +.if defined(__MINIX) +# BJG - stack unwinding (for C++ exceptions) doesn't work on static executables when built with llvm. +LDSTATIC= -dynamic +.endif # defined(__MINIX) +.endif + +.if defined(RUMPPRG) +PROG= ${RUMPPRG} +. ifndef CRUNCHEDPROG +. if (${MKRUMP} != "no") +PROGS= ${RUMPPRG} rump.${RUMPPRG} +. else +PROGS= ${RUMPPRG} +. endif +. if defined(SRCS) +. if (${MKRUMP} != "no") +SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS} +. endif +SRCS+= ${PROG}_hostops.c +. else +SRCS= ${PROG}.c ${PROG}_hostops.c +. if (${MKRUMP} != "no") +SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS} +. endif +. endif +. if (${MKRUMP} != "no") +DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS} +LDADD.rump.${PROG}+= -lrumpclient +DPADD.rump.${PROG}+= ${LIBRUMPCLIENT} +MAN.rump.${PROG}= # defined but feeling empty +_RUMPINSTALL.rump.${PROG}=# defined +. endif +. else # CRUNCHEDPROG +PROGS= ${PROG} +CPPFLAGS+= -DCRUNCHOPS +. endif +.endif + +.if defined(PROG) +_CCLINK?= ${CC} ${_CCLINKFLAGS} +. if defined(MAN) +MAN.${PROG}= ${MAN} +_APPEND_MANS= no +. endif +. if !defined(OBJS) +OBJS= ${OBJS.${PROG}} +. endif +. if defined(PROGNAME) +PROGNAME.${PROG}= ${PROGNAME} +. endif +. if defined(SRCS) +SRCS.${PROG}= ${SRCS} +_APPEND_SRCS= no +. endif +.endif + +# Turn the single-program PROG and PROG_CXX variables into their multi-word +# counterparts, PROGS and PROGS_CXX. +.if !defined(RUMPPRG) +. if defined(PROG_CXX) && !defined(PROGS_CXX) +PROGS_CXX= ${PROG_CXX} +. elif defined(PROG) && !defined(PROGS) +PROGS= ${PROG} +. endif +.endif + +##### Libraries that this may depend upon. +.if defined(PROGDPLIBS) # { +.for _lib _dir in ${PROGDPLIBS} +.if !defined(BINDO.${_lib}) +PROGDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} +.MAKEOVERRIDES+=PROGDO.${_lib} +.endif +LDADD+= -L${PROGDO.${_lib}} -l${_lib} +.if exists(${PROGDO.${_lib}}/lib${_lib}_pic.a) +DPADD+= ${PROGDO.${_lib}}/lib${_lib}_pic.a +.elif exists(${PROGDO.${_lib}}/lib${_lib}.so) +DPADD+= ${PROGDO.${_lib}}/lib${_lib}.so +.else +DPADD+= ${PROGDO.${_lib}}/lib${_lib}.a +.endif +.endfor +.endif # } +# +# Per-program definitions and targets. +# + +_CCLINK.CDEFAULT= ${CC} ${_CCLINKFLAGS} +# Definitions specific to C programs. +.for _P in ${PROGS} +SRCS.${_P}?= ${_P}.c +_CCLINK.${_P}= ${CC} ${_CCLINKFLAGS} +_CFLAGS.${_P}= ${CFLAGS} ${CPUFLAGS} +_CPPFLAGS.${_P}= ${CPPFLAGS} +_COPTS.${_P}= ${COPTS} +.endfor + +_CCLINK.CXXDEFAULT= ${CXX} ${_CCLINKFLAGS} +# Definitions specific to C++ programs. +.for _P in ${PROGS_CXX} +SRCS.${_P}?= ${_P}.cc +_CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS} +.endfor + +# Language-independent definitions. +.if defined(__MINIX) +.if ${USE_BITCODE:Uno} == "yes" +CFLAGS+= -flto +.endif # ${USE_BITCODE:Uno} == "yes" + +.if ${USE_BITCODE:Uyes} == "no" +#LSC Gold linker seems to require the library directory to be set up if +# a sysroot parameter has been given. +LDFLAGS+= -L ${DESTDIR}/usr/lib +.endif # ${USE_BITCODE:U} == "no" +.endif # defined(__MINIX) + +.for _P in ${PROGS} ${PROGS_CXX} # { + +BINDIR.${_P}?= ${BINDIR} +PROGNAME.${_P}?= ${_P} + +.if ${MKDEBUG} != "no" && !commands(${_P}) +_PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug +.endif + +.if defined(PAXCTL_FLAGS) +PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS} +.endif + +##### PROG specific flags. + +_DPADD.${_P}= ${DPADD} ${DPADD.${_P}} +_LDADD.${_P}= ${LDADD} ${LDADD.${_P}} +_LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}} +_LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}} + +##### Build and install rules +.if !empty(_APPEND_SRCS:M[Yy][Ee][Ss]) +SRCS+= ${SRCS.${_P}} # For bsd.dep.mk +.endif + +_YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}} + +DPSRCS+= ${_YPSRCS.${_P}} +CLEANFILES+= ${_YPSRCS.${_P}} + +.if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth) +OBJS.${_P}+= ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g} +LOBJS.${_P}+= ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln} +.endif + +.if defined(OBJS.${_P}) && !empty(OBJS.${_P}) # { +.NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}} + +.if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \ + && (${_CCLINK.${_P}} == ${_CCLINK.CDEFAULT} \ + || ${_CCLINK.${_P}} == ${_CCLINK.CXXDEFAULT}) \ + && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE)) +.for f in ${SRCS.${_P}:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g} +#_XFLAGS.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} \ +# ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5} +.if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \ + || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \ + || ${CXXFLAGS.$f:D5} == "5") \ + || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/})) +XOBJS.${_P}+= ${f:R:S/$/.o/} +.else +XSRCS.${_P}+= ${f} +NODPSRCS+= ${f} +.endif +.endfor + +${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${XOBJS.${_P}} ${SRCS.${_P}} \ + ${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}} + ${_MKTARGET_LINK} +.if defined(DESTDIR) + ${_CCLINK.${_P}} -Wl,-nostdlib \ + ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \ + -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \ + -MD --combine ${_CPPFLAGS.${_P}} ${_CFLAGS.${_P}} ${_COPTS.${_P}} \ + ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \ + ${_LDADD.${_P}} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib +.else + ${_CCLINK.${_P}} ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \ + -MD --combine ${_CPPFLAGS.${_P}} ${_COPTS.${_P}} + ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \ + ${_LDADD.${_P}} +.endif # defined(DESTDIR) +.if defined(CTFMERGE) + ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}} +.endif +.if defined(PAXCTL_FLAGS.${_P}) + ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET} +.endif +.if ${MKSTRIPIDENT} != "no" + ${OBJCOPY} -R .ident ${.TARGET} +.endif + +CLEANFILES+= ${_P}.d +.if exists(${_P}.d) +.include "${_P}.d" # include -MD depend for program. +.endif +.else # USE_COMBINE + +${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS} + +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +CLEANFILES+= ${_P}.opt.bcl ${_P}.bcl ${_P}.bcl.o + +OPTFLAGS.${_P}?= ${OPTFLAGS} +BITCODE_LD_FLAGS_1ST.${_P}+= ${BITCODE_LD_FLAGS_1ST} +BITCODE_LD_FLAGS_2ND.${_P}+= ${BITCODE_LD_FLAGS_2ND} + +${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ + ${LIBCRTEND} ${_DPADD.${_P}} + ${_MKTARGET_LINK} + ${_CCLINK.${_P}} \ + -o ${.TARGET} \ + -nostartfiles \ + -L${DESTDIR}/usr/lib/bc \ + ${OBJS.${_P}} ${LLVM_LINK_ARGS} ${_LDADD.${_P}:N-shared} \ + ${_LDSTATIC.${_P}} ${_PROGLDOPTS} \ + -Wl,-r \ + ${BITCODE_LD_FLAGS_1ST.${_P}} \ + -Wl,-plugin-opt=emit-llvm + +${_P}.opt.bcl: ${_P}.bcl ${LLVM_PASS} + ${_MKTARGET_LINK} + ${OPT} ${OPTFLAGS.${_P}} -o ${.TARGET} ${_P}.bcl + +${_P}.bcl.o: ${_P}.opt.bcl + ${_MKTARGET_LINK} + ${LLC} -O1 -march=x86 -mcpu=i586 -filetype=obj -o ${.TARGET} ${.ALLSRC} + +${_P}: ${_P}.bcl.o +.if !commands(${_P}) + ${_MKTARGET_LINK} + ${_CCLINK.${_P}} \ + ${_LDFLAGS.${_P}} \ + -L${DESTDIR}/usr/lib \ + ${_LDSTATIC.${_P}} -o ${.TARGET} \ + ${.TARGET}.bcl.o ${_PROGLDOPTS} ${_LDADD.${_P}} \ + ${BITCODE_LD_FLAGS_2ND.${_P}} \ + -Wl,--allow-multiple-definition +.endif # !commands(${_P}) + +.else +${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ + ${LIBCRTEND} ${_DPADD.${_P}} +.if !commands(${_P}) + ${_MKTARGET_LINK} + ${_CCLINK.${_P}} \ + ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \ + ${OBJS.${_P}} ${_PROGLDOPTS} ${_LDADD.${_P}} +.if defined(CTFMERGE) + ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}} +.endif +.if defined(PAXCTL_FLAGS.${_P}) + ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET} +.endif +.if ${MKSTRIPIDENT} != "no" + ${OBJCOPY} -R .ident ${.TARGET} +.endif +.endif # !commands(${_P}) +.endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +.endif # USE_COMBINE + +${_P}.ro: ${OBJS.${_P}} ${_DPADD.${_P}} + ${_MKTARGET_LINK} + ${CC} ${LDFLAGS:N-Wl,-pie} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}} + +.if defined(_PROGDEBUG.${_P}) +${_PROGDEBUG.${_P}}: ${_P} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \ + && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ + --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \ + ) || (rm -f ${_PROGDEBUG.${_P}}; false) +.endif + +.endif # defined(OBJS.${_P}) && !empty(OBJS.${_P}) # } + +.if !defined(MAN.${_P}) +MAN.${_P}= ${_P}.1 +.endif # !defined(MAN.${_P}) +.if !empty(_APPEND_MANS:M[Yy][Ee][Ss]) +MAN+= ${MAN.${_P}} +.endif + +realall: ${_P} ${_PROGDEBUG.${_P}} + +CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}} + +.if defined(OBJS.${_P}) && !empty(OBJS.${_P}) +CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}} +.endif + +_PROG_INSTALL+= proginstall-${_P} + +.if !target(proginstall-${_P}) # { +proginstall-${_P}:: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \ + ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}} +.PRECIOUS: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \ + ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}} + +.if ${MKUPDATE} == "no" +.if defined(_RUMPINSTALL.${_P}) +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall +.else +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall +.endif +.if !defined(BUILD) && !make(all) && !make(${_P}) +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE +.endif +.if defined(_PROGDEBUG.${_P}) +${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall +.if !defined(BUILD) && !make(all) && !make(${_P}) +${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE +.endif +.endif # define(_PROGDEBUG.${_P}) +.else # MKUPDATE != no +.if defined(_RUMPINSTALL.${_P}) +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall +.else +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall +.endif +.if !defined(BUILD) && !make(all) && !make(${_P}) +${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE +.endif +.if defined(_PROGDEBUG.${_P}) +${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall +.if !defined(BUILD) && !make(all) && !make(${_P}) +${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE +.endif +.endif # defined(_PROGDEBUG.${_P}) +.endif # MKUPDATE != no + +.endif # !target(proginstall-${_P}) # } + +lint: lint-${_P} +lint-${_P}: ${LOBJS.${_P}} +.if defined(LOBJS.${_P}) && !empty(LOBJS.${_P}) + ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}} +.endif + +.endfor # _P in ${PROGS} ${PROGS_CXX} # } + +.if defined(OBJS) && !empty(OBJS) && \ + (empty(PROGS) && empty(PROGS_CXX)) +CLEANFILES+= ${OBJS} ${LOBJS} +.endif + +.if !target(proginstall) +proginstall:: ${_PROG_INSTALL} +.endif +.PHONY: proginstall + + + +realall: ${SCRIPTS} +.if defined(SCRIPTS) && !target(scriptsinstall) # { +SCRIPTSDIR?=${BINDIR} +SCRIPTSOWN?=${BINOWN} +SCRIPTSGRP?=${BINGRP} +SCRIPTSMODE?=${BINMODE} + +scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@} +.PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@} + +__scriptinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} \ + -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \ + -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \ + -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \ + ${.ALLSRC} ${.TARGET} + +.for S in ${SCRIPTS:O:u} +.if ${MKUPDATE} == "no" +${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall +.if !defined(BUILD) && !make(all) && !make(${S}) +${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE +.endif +.else +${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall +.if !defined(BUILD) && !make(all) && !make(${S}) +${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE +.endif +.endif +.endfor +.endif # } + +.if !target(scriptsinstall) +scriptsinstall:: +.endif +.PHONY: scriptsinstall + +##### Pull in related .mk logic +LINKSOWN?= ${BINOWN} +LINKSGRP?= ${BINGRP} +LINKSMODE?= ${BINMODE} +.include +.include +.include +.include +.include +.include +.include +.include +.include + +${TARGETS}: # ensure existence + +.endif # HOSTPROG diff --git a/src/share/mk/ubix.rpc.mk b/src/share/mk/ubix.rpc.mk new file mode 100644 index 0000000..39d8c41 --- /dev/null +++ b/src/share/mk/ubix.rpc.mk @@ -0,0 +1,76 @@ +# $NetBSD: bsd.rpc.mk,v 1.13 2013/12/15 00:28:45 christos Exp $ + +.include + +RPC_XDIR?= ${.CURDIR}/ +RPCGEN_FLAGS?= -B + +# We don't use implicit suffix rules here to avoid dependencies in the +# Installed files. + +.if defined(RPC_INCS) # { + +.for I in ${RPC_INCS} +${I}: ${I:.h=.x} + ${_MKTARGET_CREATE} + ${TOOL_RPCGEN} ${RPCGEN_FLAGS} -h ${RPC_XDIR}${I:.h=.x} -o ${.TARGET} +.endfor + +DPSRCS+= ${RPC_INCS} +CLEANFILES+= ${RPC_INCS} + +.endif # } + + +.if defined(RPC_XDRFILES) # { + +.for I in ${RPC_XDRFILES} +${I}: ${RPC_XDIR}${I:_xdr.c=.x} + ${_MKTARGET_CREATE} + ${TOOL_RPCGEN} ${RPCGEN_FLAGS} -c ${RPC_XDIR}${I:_xdr.c=.x} -o ${.TARGET} +.endfor + +DPSRCS+= ${RPC_XDRFILES} +CLEANFILES+= ${RPC_XDRFILES} + +.endif # } + + +.if defined(RPC_SVCFILES) # { + +.for I in ${RPC_SVCCLASS} +_RPCS += -s ${I} +.endfor + +.for I in ${RPC_SVCFILES} + +${I}: ${RPC_XDIR}${I:_svc.c=.x} + ${_MKTARGET_CREATE} + ${TOOL_RPCGEN} ${RPCGEN_FLAGS} ${_RPCS} ${RPC_SVCFLAGS} ${RPC_XDIR}${I:_svc.c=.x} \ + -o ${.TARGET} +.endfor + +DPSRCS+= ${RPC_SVCFILES} +CLEANFILES+= ${RPC_SVCFILES} + +.endif # } + +.if defined(RPC_CLNTFILES) # { + +.for I in ${RPC_CLNTFILES} + +${I}: ${RPC_XDIR}${I:_clnt.c=.x} + ${_MKTARGET_CREATE} + ${TOOL_RPCGEN} ${RPCGEN_FLAGS} -l ${_RPCS} ${RPC_CLNTFLAGS} \ + ${RPC_XDIR}${I:_clnt.c=.x} -o ${.TARGET} +.endfor + +DPSRCS+= ${RPC_CLNTFILES} +CLEANFILES+= ${RPC_CLNTFILES} + +.endif # } + +##### Pull in related .mk logic +.include +.include +.include diff --git a/src/share/mk/ubix.service.mk b/src/share/mk/ubix.service.mk new file mode 100644 index 0000000..daf7f15 --- /dev/null +++ b/src/share/mk/ubix.service.mk @@ -0,0 +1,102 @@ +# MINIX-specific servers/drivers options +.include + +# LSC: Our minimal c library has no putchar, which is called by the builtin +# functions of the compiler, so prevent using them. + +AFLAGS+= -D__ASSEMBLY__ +COPTS+= -fno-builtin + +# For MKCOVERAGE builds, enable coverage options. +.if ${MKCOVERAGE:Uno} == "yes" +CPPFLAGS+= ${COVCPPFLAGS} +LDADD+= ${COVLDADD} +.endif # ${MKCOVERAGE:Uno} == "yes" + +# LSC Static linking, order matters! +# We can't use --start-group/--end-group as they are not supported by our +# version of clang. + +# 1. No default libs +LDADD:= -nodefaultlibs ${LDADD} + +# 2. Services system library +LDADD+= -lsys +DPADD+= ${LIBSYS} + +# 3. Minimal C library, if libc had not yet been added +.if ${LDADD:M-lc} == "" +LDADD+= -lminc +DPADD+= ${LIBMINC} +.endif # empty(${LDADD:M-lc}) + +.if ${MACHINE_ARCH} == "earm" + +# LSC: On ARM, when compiling statically, with gcc, lgcc_eh is required +.if ${PROG:U} != "kernel" && !empty(CC:M*gcc) +# gcc_eh uses abort(), which is provided by minc +LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:} +.endif # ${PROG:U} != "kernel" && !empty(CC:M*gcc) + +.endif # ${MACHINE_ARCH} == "earm" + +# Get (more) internal minix definitions and declarations. +CPPFLAGS += -D_MINIX_SYSTEM=1 + +# For MKMAGIC builds, link services against libmagicrt and run the magic pass +# on them, unless they have specifically requested to be built without bitcode. +.if ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes" +LIBMAGICST?= ${DESTDIR}${LIBDIR}/libmagicrt.bcc +MAGICPASS?= ${NETBSDSRCDIR}/minix/llvm/bin/magic.so + +DPADD+= ${LIBMAGICST} ${MAGICPASS} + +.for _P in ${PROGS:U${PROG}} +BITCODE_LD_FLAGS_1ST.${_P}?= ${LIBMAGICST} +.endfor + +MAGICFLAGS?= +OPTFLAGS+= -load ${MAGICPASS} -magic ${MAGICFLAGS} + +# For MKASR builds, generate an additional set of rerandomized service +# binaries. +.if ${USE_ASR:Uno} == "yes" +ASRPASS?= ${NETBSDSRCDIR}/minix/llvm/bin/asr.so +ASRCOUNT?= 3 +ASRDIR?= /usr/service/asr + +DPADD+= ${ASRPASS} + +OPTFLAGS+= -load ${ASRPASS} -asr + +# Produce a variable _RANGE that contains "1 2 3 .. ${ASRCOUNT}". We do not +# want to invoke a shell command to do this; what if the host platform does not +# have seq(1) ? So, we do it with built-in BSD make features instead. There +# are probably substantially better ways to do this, though. Right now the +# maximum ASRCOUNT is 65536 (16**4), which should be plenty. An ASRCOUNT of 0 +# is not supported, nor would it be very useful. +_RANGE= 0 +_G0= xxxxxxxxxxxxxxxx +_G= ${_G0:S/x/${_G0}/g:S/x/${_G0}/g:S/x/${_G0}/g} +.for _X in ${_G:C/^(.{${ASRCOUNT}}).*/\1/:S/x/x /g} +_RANGE:= ${_RANGE} ${_RANGE:[#]} +.endfor +_RANGE:= ${_RANGE:[2..-1]} + +# Add progname-1, progname-2, progname-3 (etc) to the list of programs to +# generate, and install (just) these to ASRDIR. +PROGS?= ${PROG} +_PROGLIST:= ${PROGS} +.for _N in ${_RANGE} +.for _P in ${_PROGLIST} +PROGS+= ${_P}-${_N} +SRCS.${_P}-${_N}= ${SRCS.${_P}:U${SRCS}} +BITCODE_LD_FLAGS_1ST.${_P}-${_N}:= ${BITCODE_LD_FLAGS_1ST.${_P}} +BINDIR.${_P}-${_N}= ${ASRDIR} +.endfor +.endfor + +.endif # ${USE_ASR:Uno} == "yes" +.endif # ${USE_BITCODE:Uno} == "yes" && ${USE_MAGIC:Uno} == "yes" + +.include diff --git a/src/share/mk/ubix.shlib.mk b/src/share/mk/ubix.shlib.mk new file mode 100644 index 0000000..bb058c2 --- /dev/null +++ b/src/share/mk/ubix.shlib.mk @@ -0,0 +1,40 @@ +# $NetBSD: bsd.shlib.mk,v 1.8 2012/08/23 21:21:17 joerg Exp $ + +.if !defined(_BSD_SHLIB_MK_) +_BSD_SHLIB_MK_=1 + +.if ${MKDYNAMICROOT} == "no" +SHLIBINSTALLDIR?= /usr/lib +.else +SHLIBINSTALLDIR?= /lib +.endif + +.if ${MKDYNAMICROOT} == "no" || \ + (${BINDIR:Ux} != "/bin" && ${BINDIR:Ux} != "/sbin" && \ + ${BINDIR:Ux} != "/libexec" && ${USE_SHLIBDIR:Uno} == "no") +SHLIBDIR?= /usr/lib +.else +SHLIBDIR?= /lib +.endif + +.if ${USE_SHLIBDIR:Uno} != "no" +_LIBSODIR?= ${SHLIBINSTALLDIR} +.else +_LIBSODIR?= ${LIBDIR} +.endif + +.if ${MKDYNAMICROOT} == "no" +SHLINKINSTALLDIR?= /usr/libexec +.else +SHLINKINSTALLDIR?= /libexec +.endif + +.if ${MKDYNAMICROOT} == "no" || \ + (${BINDIR:Ux} != "/bin" && ${BINDIR:Ux} != "/sbin" && \ + ${BINDIR:Ux} != "/libexec") +SHLINKDIR?= /usr/libexec +.else +SHLINKDIR?= /libexec +.endif + +.endif # !defined(_BSD_SHLIB_MK_) diff --git a/src/share/mk/ubix.subdir.mk b/src/share/mk/ubix.subdir.mk index 5ec8c95..0692f40 100644 --- a/src/share/mk/ubix.subdir.mk +++ b/src/share/mk/ubix.subdir.mk @@ -1,6 +1,9 @@ -.include +# $NetBSD: bsd.subdir.mk,v 1.52 2010/05/26 00:48:15 uwe Exp $ +# @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93 -.if !defined(NOSUBDIR) # { +.include + +.if !defined(NOSUBDIR) # { .for dir in ${SUBDIR} .if "${dir}" == ".WAIT" @@ -29,10 +32,10 @@ @${MAKEDIRTARGET} ${.TARGET:C/^[^-]*-//} ${.TARGET:C/-.*$//} .if make(cleandir) -__RECURSETARG= ${TARGETS:Nclean} +__RECURSETARG= ${TARGETS:Nclean} clean: .else -__RECURSETARG= ${TARGETS} +__RECURSETARG= ${TARGETS} .endif # for obscure reasons, we can't do a simple .if ${dir} == ".WAIT" @@ -51,6 +54,6 @@ ${targ}: subdir-${targ} .endfor -.endif # ! NOSUBDIR # } +.endif # ! NOSUBDIR # } -${TARGETS}: # ensure existence +${TARGETS}: # ensure existence diff --git a/src/share/mk/ubix.sys.mk b/src/share/mk/ubix.sys.mk new file mode 100644 index 0000000..322fc2d --- /dev/null +++ b/src/share/mk/ubix.sys.mk @@ -0,0 +1,289 @@ +# $NetBSD: bsd.sys.mk,v 1.245 2014/09/03 19:22:53 matt Exp $ +# +# Build definitions used for NetBSD source tree builds. + +.if !defined(_BSD_SYS_MK_) +_BSD_SYS_MK_=1 + +.if !empty(.INCLUDEDFROMFILE:MMakefile*) +error1: + @(echo "bsd.sys.mk should not be included from Makefiles" >& 2; exit 1) +.endif +.if !defined(_BSD_OWN_MK_) +error2: + @(echo "bsd.own.mk must be included before bsd.sys.mk" >& 2; exit 1) +.endif + +.if defined(__MINIX) +#LSC: Be a bit smarter about the default compiler +.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) +CC?= clang +.endif + +.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) +CC?= gcc +.endif + +MKDEP?= CC=${CC:Q} mkdep +MKDEPCXX?= CC=${CXX:Q} mkdep +.endif # defined(__MINIX) + +.if ${MKREPRO:Uno} == "yes" +CPPFLAGS+= -Wp,-iremap,${NETBSDSRCDIR}:/usr/src +CPPFLAGS+= -Wp,-iremap,${DESTDIR}/:/ +CPPFLAGS+= -Wp,-iremap,${X11SRCDIR}:/usr/xsrc +.endif + +# NetBSD sources use C99 style, with some GCC extensions. +CFLAGS+= ${${ACTIVE_CC} == "clang":? -std=gnu99 :} +CFLAGS+= ${${ACTIVE_CC} == "gcc":? -std=gnu99 :} +CFLAGS+= ${${ACTIVE_CC} == "pcc":? -std=gnu99 :} + +.if defined(WARNS) +CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wno-sign-compare -Wno-pointer-sign :} +.if ${WARNS} > 0 +CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith +#CFLAGS+= -Wmissing-declarations -Wredundant-decls -Wnested-externs +# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, +# but our sources aren't up for it yet. Also, add -Wno-traditional because +# gcc includes #elif in the warnings, which is 'this code will not compile +# in a traditional environment' warning, as opposed to 'this code behaves +# differently in traditional and ansi environments' which is the warning +# we wanted, and now we don't get anymore. +CFLAGS+= -Wno-sign-compare +CFLAGS+= ${${ACTIVE_CC} == "gcc" :? -Wno-traditional :} +.if !defined(NOGCCERROR) && !defined(USE_BITCODE) +# Set assembler warnings to be fatal +CFLAGS+= -Wa,--fatal-warnings +.endif +# Set linker warnings to be fatal +# XXX no proper way to avoid "FOO is a patented algorithm" warnings +# XXX on linking static libs +.if (!defined(MKPIC) || ${MKPIC} != "no") && \ + (!defined(LDSTATIC) || ${LDSTATIC} != "-static") +# XXX there are some strange problems not yet resolved +. if defined(HAVE_LLVM) && !defined(USE_BITCODE) +LDFLAGS+= -Wl,--fatal-warnings +. endif +.endif +.endif +.if ${WARNS} > 1 +CFLAGS+= -Wreturn-type -Wswitch -Wshadow +.endif +.if ${WARNS} > 2 +CFLAGS+= -Wcast-qual -Wwrite-strings +CFLAGS+= -Wextra -Wno-unused-parameter +# Readd -Wno-sign-compare to override -Wextra with clang +CFLAGS+= -Wno-sign-compare +CXXFLAGS+= -Wabi +CXXFLAGS+= -Wold-style-cast +CXXFLAGS+= -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \ + -Wno-deprecated -Woverloaded-virtual -Wsign-promo -Wsynth +CXXFLAGS+= ${${ACTIVE_CXX} == "gcc":? -Wno-non-template-friend -Wno-pmf-conversions :} +.endif +.if ${WARNS} > 3 && (defined(HAVE_GCC) || defined(HAVE_LLVM)) +.if ${WARNS} > 4 +CFLAGS+= -Wold-style-definition +.endif +.if ${WARNS} > 5 && !(defined(HAVE_GCC) && ${HAVE_GCC} <= 45) +CFLAGS+= -Wconversion +.endif +CFLAGS+= -Wsign-compare -Wformat=2 +CFLAGS+= ${${ACTIVE_CC} == "gcc":? -Wno-format-zero-length :} +.endif +.if ${WARNS} > 3 && defined(HAVE_LLVM) +CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wpointer-sign -Wmissing-noreturn :} +.endif +.if (defined(HAVE_GCC) \ + && (${MACHINE_ARCH} == "coldfire" || \ + ${MACHINE_ARCH} == "sh3eb" || \ + ${MACHINE_ARCH} == "sh3el" || \ + ${MACHINE_ARCH} == "m68k" || \ + ${MACHINE_ARCH} == "m68000")) +# XXX GCC 4.5 for sh3 and m68k (which we compile with -Os) is extra noisy for +# cases it should be better with +CFLAGS+= -Wno-uninitialized +.if ${HAVE_GCC} >= 48 +CFLAGS+= -Wno-maybe-uninitialized +.endif +.endif +.endif + +CWARNFLAGS+= ${CWARNFLAGS.${ACTIVE_CC}} + +CPPFLAGS+= ${AUDIT:D-D__AUDIT__} +_NOWERROR= ${defined(NOGCCERROR) || (${ACTIVE_CC} == "clang" && defined(NOCLANGERROR)):?yes:no} +.if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes" +_NOWERROR= yes +.endif # defined(__MINIX) && ${USE_BITCODE} == "yes" +CFLAGS+= ${${_NOWERROR} == "no" :?-Werror:} ${CWARNFLAGS} +LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include} + +.if (${USE_SSP:Uno} != "no") && (${BINDIR:Ux} != "/usr/mdec") +.if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels nor kern modules +CPPFLAGS+= -D_FORTIFY_SOURCE=2 +.endif +COPTS+= -fstack-protector -Wstack-protector + +# gcc 4.8 on m68k erroneously does not protect functions with +# variables needing special alignement, see +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59674 +# (the underlying issue for sh and vax may be different, needs more +# investigation, symptoms are similar but for different sources) +.if "${ACTIVE_CC}" == "gcc" && "${HAVE_GCC}" == "48" && \ + ( ${MACHINE_CPU} == "sh3" || \ + ${MACHINE_ARCH} == "vax" || \ + ${MACHINE_CPU} == "m68k" || \ + ${MACHINE_CPU} == "or1k" ) +COPTS+= -Wno-error=stack-protector +.endif + +COPTS+= ${${ACTIVE_CC} == "clang":? --param ssp-buffer-size=1 :} +COPTS+= ${${ACTIVE_CC} == "gcc":? --param ssp-buffer-size=1 :} +.endif + +.if ${MKSOFTFLOAT:Uno} != "no" +COPTS+= ${${ACTIVE_CC} == "gcc":? -msoft-float :} +FOPTS+= -msoft-float +.elif ${MACHINE_ARCH} == "coldfire" +COPTS+= -mhard-float +FOPTS+= -mhard-float +.endif + +.if ${MKIEEEFP:Uno} != "no" +.if ${MACHINE_ARCH} == "alpha" +CFLAGS+= -mieee +FFLAGS+= -mieee +.endif +.endif + +.if ${MACHINE} == "sparc64" && ${MACHINE_ARCH} == "sparc" +CFLAGS+= -Wa,-Av8plus +.endif + +.if !defined(NOGCCERROR) +.if (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb") +CPUFLAGS+= -Wa,--fatal-warnings +.endif +.endif + +#.if ${MACHINE} == "sbmips" +#CFLAGS+= -mips64 -mtune=sb1 +#.endif + +#.if (${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") && \ +# (defined(MKPIC) && ${MKPIC} == "no") +#CPUFLAGS+= -mno-abicalls -fno-PIC +#.endif +CFLAGS+= ${CPUFLAGS} +AFLAGS+= ${CPUFLAGS} + +.if !defined(LDSTATIC) || ${LDSTATIC} != "-static" +# Position Independent Executable flags +PIE_CFLAGS?= -fPIC +PIE_LDFLAGS?= -Wl,-pie ${${ACTIVE_CC} == "gcc":? -shared-libgcc :} +PIE_AFLAGS?= -fPIC +.endif + +ELF2ECOFF?= elf2ecoff +MKDEP?= mkdep +MKDEPCXX?= mkdep +OBJCOPY?= objcopy +OBJDUMP?= objdump +PAXCTL?= paxctl +STRIP?= strip + +.SUFFIXES: .o .ln .lo .c .cc .cpp .cxx .C .m ${YHEADER:D.h} + +# C +.c.o: + ${_MKTARGET_COMPILE} + ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + +.c.ln: + ${_MKTARGET_COMPILE} + ${LINT} ${LINTFLAGS} ${LINTFLAGS.${.IMPSRC:T}} \ + ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + ${CPPFLAGS.${.IMPSRC:T}:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ + -i ${.IMPSRC} + +# C++ +.cc.o .cpp.o .cxx.o .C.o: + ${_MKTARGET_COMPILE} + ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} + +# Objective C +# (Defined here rather than in because `.m' is not just +# used for Objective C source) +.m.o: + ${_MKTARGET_COMPILE} + ${COMPILE.m} ${OBJCOPTS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + +# Host-compiled C objects +# The intermediate step is necessary for Sun CC, which objects to calling +# object files anything but *.o +.c.lo: + ${_MKTARGET_COMPILE} + ${HOST_COMPILE.c} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} + mv ${.TARGET}.o ${.TARGET} + +# C++ +.cc.lo .cpp.lo .cxx.lo .C.lo: + ${_MKTARGET_COMPILE} + ${HOST_COMPILE.cc} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} + mv ${.TARGET}.o ${.TARGET} + +# Assembly +.s.o: + ${_MKTARGET_COMPILE} + ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + +.S.o: + ${_MKTARGET_COMPILE} + ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif + +# Lex +LFLAGS+= ${LPREFIX.${.IMPSRC:T}:D-P${LPREFIX.${.IMPSRC:T}}} +LFLAGS+= ${LPREFIX:D-P${LPREFIX}} + +.l.c: + ${_MKTARGET_LEX} + ${LEX.l} -o${.TARGET} ${.IMPSRC} + +# Yacc +YFLAGS+= ${YPREFIX.${.IMPSRC:T}:D-p${YPREFIX.${.IMPSRC:T}}} ${YHEADER.${.IMPSRC:T}:D-d} +YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} + +.y.c: + ${_MKTARGET_YACC} + ${YACC.y} -o ${.TARGET} ${.IMPSRC} + +.ifdef YHEADER +.if empty(.MAKEFLAGS:M-n) +.y.h: ${.TARGET:.h=.c} +.endif +.endif + +# Objcopy +.if ${MACHINE_ARCH} == aarch64eb +# AARCH64 big endian needs to preserve $x/$d symbols for the linker. +OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][dx]' -K '[$$][dx]\.*' +.elif !empty(MACHINE_ARCH:M*arm*eb) +# ARM big endian needs to preserve $a/$d/$t symbols for the linker. +OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][adt]' -K '[$$][adt]\.*' +.endif +OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} ${OBJCOPYLIBFLAGS_EXTRA} + +.endif # !defined(_BSD_SYS_MK_) diff --git a/src/share/mk/ubix.syscall.mk b/src/share/mk/ubix.syscall.mk new file mode 100644 index 0000000..6a3e160 --- /dev/null +++ b/src/share/mk/ubix.syscall.mk @@ -0,0 +1,16 @@ +# $NetBSD: bsd.syscall.mk,v 1.2 2014/01/16 01:19:46 christos Exp $ +# +.include + +SYSCALL_OBJS?= ${SYSCALL_PREFIX}_sysent.c ${SYSCALL_PREFIX}_syscalls.c \ + ${SYSCALL_PREFIX}_syscall.h ${SYSCALL_PREFIX}_syscallargs.h + +SYSCALL_DEPS?= ${NETBSDSRCDIR}/sys/kern/makesyscalls.sh \ + syscalls.conf syscalls.master + +all: ${SYSCALL_OBJS} + +${SYSCALL_OBJS}: ${SYSCALL_DEPS} + ${HOST_SH} ${.ALLSRC} + +.include diff --git a/src/share/mk/ubix.test.mk b/src/share/mk/ubix.test.mk new file mode 100644 index 0000000..7f9954d --- /dev/null +++ b/src/share/mk/ubix.test.mk @@ -0,0 +1,207 @@ +# $NetBSD: bsd.test.mk,v 1.24 2013/02/23 22:01:51 jmmv Exp $ +# + +.include + +_TESTS:= # empty + +.if defined(TESTS_SUBDIRS) +SUBDIR+= ${TESTS_SUBDIRS} +.endif + +.include + +.if defined(TESTS_C) +_TESTS+= ${TESTS_C} +PROGS+= ${TESTS_C} +. for _T in ${TESTS_C} +BINDIR.${_T}= ${TESTSDIR} +LDADD.${_T}+= -latf-c +DPADD.${_T}+= ${LIBATF_C} +MAN.${_T}?= # empty +. endfor +.endif + +.if defined(TESTS_CXX) +_TESTS+= ${TESTS_CXX} +PROGS_CXX+= ${TESTS_CXX} +. for _T in ${TESTS_CXX} +BINDIR.${_T}= ${TESTSDIR} +LDADD.${_T}+= -latf-c++ -latf-c +DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C} +MAN.${_T}?= # empty +. endfor +.endif + +.if defined(TESTS_SH) +_TESTS+= ${TESTS_SH} +CLEANDIRFILES+= ${TESTS_SH} + +. for _T in ${TESTS_SH} +SCRIPTS+= ${_T} +SCRIPTSDIR_${_T}= ${TESTSDIR} + +CLEANDIRFILES+= ${_T}.tmp + +TESTS_SH_SRC_${_T}?= ${_T}.sh +${_T}: ${TESTS_SH_SRC_${_T}} + ${_MKTARGET_BUILD} + echo '#! /usr/bin/atf-sh' >${.TARGET}.tmp + cat ${.ALLSRC} >>${.TARGET}.tmp + chmod +x ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} +. endfor +.endif + +ATFFILE?= auto +.if ${MKKYUA} != "no" +KYUAFILE?= ${ATFFILE} +.else +KYUAFILE= no +.endif + +# Additional list of 'tp' entries to add to the Atffile when ATFFILE=auto. +# These entries must all correspond to subdirectories to descend into. +# +# This is useful in the cases where the tests in a single directory come +# from various sources (e.g. src/tests and src/external/.../tests) and +# the installation of some of those tests rely on MK* variables being set. +ATFFILE_EXTRA_SUBDIRS?= + +.if ${ATFFILE:tl} != "no" +FILES+= Atffile +FILESDIR_Atffile= ${TESTSDIR} + +. if ${ATFFILE:tl} == "auto" +CLEANDIRFILES+= Atffile Atffile.tmp + +realall: Atffile +Atffile: Makefile + ${_MKTARGET_CREATE} + @{ echo 'Content-Type: application/X-atf-atffile; version="1"'; \ + echo; \ + echo '# Automatically generated by bsd.test.mk.'; \ + echo; \ + echo 'prop: test-suite = "NetBSD"'; \ + echo; \ + for tp in ${TESTS_SUBDIRS:N.WAIT} ${_TESTS} ${ATFFILE_EXTRA_SUBDIRS}; \ + do \ + echo "tp: $${tp}"; \ + done; } >Atffile.tmp + @mv Atffile.tmp Atffile +. endif +.endif + +.if ${KYUAFILE:tl} != "no" +FILES+= Kyuafile +FILESDIR_Kyuafile= ${TESTSDIR} + +. if ${KYUAFILE:tl} == "auto" +CLEANDIRFILES+= Kyuafile Kyuafile.tmp + +realall: Kyuafile +Kyuafile: Makefile + ${_MKTARGET_CREATE} + @{ \ + echo '-- Automatically generated by bsd.test.mk.'; \ + echo; \ + echo 'syntax(2)'; \ + echo; \ + echo 'test_suite("NetBSD")'; \ + if [ -n "${_TESTS}" ]; then \ + echo; \ + for tp in ${_TESTS}; do \ + echo "atf_test_program{name=\"$${tp}\"}"; \ + done; \ + fi; \ + if [ -n "${TESTS_SUBDIRS:N.WAIT}" -o \ + -n "${ATFFILE_EXTRA_SUBDIRS}" ]; then \ + echo; \ + for subdir in ${TESTS_SUBDIRS:N.WAIT} \ + ${ATFFILE_EXTRA_SUBDIRS}; do \ + echo "include(\"$${subdir}/Kyuafile\")"; \ + done; \ + fi; \ + } >Kyuafile.tmp + @mv Kyuafile.tmp Kyuafile +. endif +.endif + +.if ${ATFFILE:tl} != "no" || ${KYUAFILE:tl} != "no" +. include +.endif + +.if !empty(SCRIPTS) || !empty(PROGS) || !empty(PROGS_CXX) +. include +.endif + +# +# Definition of the "make test" target and supporting variables. +# +# This target, by necessity, can only work for native builds (i.e. a NetBSD +# host building a release for the same system). The target runs ATF, which is +# not in the toolchain, and the tests execute code built for the target host. +# +# Due to the dependencies of the binaries built by the source tree and how they +# are used by tests, it is highly possible for a execution of "make test" to +# report bogus results unless the new binaries are put in place. +# + +TESTS_PATH += ${DESTDIR}/bin ${DESTDIR}/sbin ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin +TESTS_LD_LIBRARY_PATH += ${DESTDIR}/lib ${DESTDIR}/usr/lib + +TESTS_ENV += ATF_BUILD_CC=${DESTDIR}/usr/bin/cc +TESTS_ENV += ATF_BUILD_CPP=${DESTDIR}/usr/bin/cpp +TESTS_ENV += ATF_BUILD_CXX=${DESTDIR}/usr/bin/c++ +TESTS_ENV += ATF_CONFDIR=${DESTDIR}/etc +TESTS_ENV += ATF_INCLUDEDIR=${DESTDIR}/usr/include +TESTS_ENV += ATF_LIBDIR=${DESTDIR}/usr/lib +TESTS_ENV += ATF_LIBEXECDIR=${DESTDIR}/usr/libexec +TESTS_ENV += ATF_PKGDATADIR=${DESTDIR}/usr/share/atf +TESTS_ENV += ATF_SHELL=${DESTDIR}/bin/sh +TESTS_ENV += LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:S/ /:/g} +TESTS_ENV += PATH=${TESTS_PATH:tW:S/ /:/g} + +_TESTS_FIFO = ${.OBJDIR}/atf-run.fifo +_TESTS_LOG = ${.OBJDIR}/atf-run.log +CLEANDIRFILES += ${_TESTS_FIFO} ${_TESTS_LOG} + +.PHONY: test +.if defined(TESTSDIR) +. if ${TESTSDIR} == ${TESTSBASE} +# Forbid this case. It is likely to cause false positives/negatives and it +# does not cover all the tests (e.g. it misses testing software in external). +test: + @echo "*** Sorry, you cannot use make test from src/tests. Install the" + @echo "*** tests into their final location and run them from /usr/tests" + @false +. else +test: + @echo "*** WARNING: make test is experimental" + @echo "***" + @echo "*** Using this test does not preclude you from running the tests" + @echo "*** installed in /usr/tests. This test run may raise false" + @echo "*** positives and/or false negatives." + @echo + @set -e; \ + cd ${DESTDIR}${TESTSDIR}; \ + rm -f ${_TESTS_FIFO}; \ + mkfifo ${_TESTS_FIFO}; \ + cat ${_TESTS_FIFO} | tee ${_TESTS_LOG} | \ + ${TESTS_ENV} ${DESTDIR}/usr/bin/atf-report & \ + result=0; \ + ${TESTS_ENV} ${DESTDIR}/usr/bin/atf-run >>${_TESTS_FIFO} || result=1; \ + wait; \ + rm -f ${_TESTS_FIFO}; \ + echo; \ + echo "*** The verbatim output of atf-run has been saved to ${_TESTS_LOG}"; \ + echo "*** Once again, note that "make test" is unsupported."; \ + test $${result} -eq 0 +. endif +.else +test: + @echo "*** No TESTSDIR defined; nothing to do." +.endif + +##### Pull in related .mk logic +.include diff --git a/src/share/mk/ubix.x1l.mk b/src/share/mk/ubix.x1l.mk new file mode 100644 index 0000000..92c5e2a --- /dev/null +++ b/src/share/mk/ubix.x1l.mk @@ -0,0 +1,433 @@ +# $NetBSD: bsd.x11.mk,v 1.117 2015/07/23 08:03:26 mrg Exp $ + +.include + +BINDIR= ${X11BINDIR} +LIBDIR= ${X11USRLIBDIR} +MANDIR= ${X11MANDIR} + +COPTS+= -fno-strict-aliasing + +.include + +.if defined(USE_SSP) && (${USE_SSP} != "no") +CPPFLAGS+= -DNO_ALLOCA +.endif + +X11FLAGS.VERSION= -DOSMAJORVERSION=5 -DOSMINORVERSION=99 # XXX + +# THREADS_DEFINES +# LSC (MINIX): Not supported: -D_REENTRANT-DXTHREADS -DXUSE_MTSAFE_API +X11FLAGS.THREADS= -DXNO_MTSAFE_PWDAPI + +# CONNECTION_FLAGS +# LSC (MINIX): Not supported: -DHAS_FCHOWN +X11FLAGS.CONNECTION= -DTCPCONN -DUNIXCONN -DHAS_STICKY_DIR_BIT \ + + +.if (${USE_INET6} != "no") +X11FLAGS.CONNECTION+= -DIPv6 +.endif + +# EXT_DEFINES +X11FLAGS.BASE_EXTENSION= -DMITMISC -DXTEST -DXTRAP -DXSYNC -DXCMISC \ + -DXRECORD -DMITSHM -DBIGREQS -DXF86VIDMODE \ + -DXF86MISC -DDPMSExtension -DEVI \ + -DSCREENSAVER -DXV -DXVMC -DGLXEXT \ + -DRES + +X11FLAGS.PERVASIVE_EXTENSION= -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP \ + -DXCSECURITY -DTOGCUP -DXF86BIGFONT \ + -DDPMSExtension -DPIXPRIV -DPANORAMIX \ + -DRENDER -DRANDR -DXFIXES -DDAMAGE \ + -DCOMPOSITE -DXEVIE +X11FLAGS.EXTENSION= ${X11FLAGS.BASE_EXTENSION} \ + ${X11FLAGS.PERVASIVE_EXTENSION} + +X11FLAGS.DIX= -DHAVE_DIX_CONFIG_H -D_BSD_SOURCE -DHAS_FCHOWN \ + -DHAS_STICKY_DIR_BIT -D_POSIX_THREAD_SAFE_FUNCTIONS \ + -DHAVE_XORG_CONFIG_H +X11INCS.DIX= -I${X11INCSDIR}/freetype2 \ + -I${X11INCSDIR}/pixman-1 \ + -I$(X11SRCDIR.xorg-server)/include \ + -I$(X11SRCDIR.xorg-server)/Xext \ + -I$(X11SRCDIR.xorg-server)/composite \ + -I$(X11SRCDIR.xorg-server)/damageext \ + -I$(X11SRCDIR.xorg-server)/xfixes \ + -I$(X11SRCDIR.xorg-server)/Xi \ + -I$(X11SRCDIR.xorg-server)/mi \ + -I$(X11SRCDIR.xorg-server)/miext/shadow \ + -I$(X11SRCDIR.xorg-server)/miext/damage \ + -I$(X11SRCDIR.xorg-server)/render \ + -I$(X11SRCDIR.xorg-server)/randr \ + -I$(X11SRCDIR.xorg-server)/fb \ + -I$(X11SRCDIR.xorg-server)/../include + +X11FLAGS.DRI= -DGLXEXT -DXF86DRI -DGLX_DIRECT_RENDERING \ + -DGLX_USE_DLOPEN -DGLX_USE_MESA + +.if ${X11DRI} != "no" +X11FLAGS.EXTENSION+= ${X11FLAGS.DRI} +.endif + +# ServerDefines +X11FLAGS.SERVER= -DSHAPE -DXKB -DLBX -DXAPPGROUP -DXCSECURITY \ + -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV \ + -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS \ + -DAVOID_GLYPHBLT -DSINGLEDEPTH -DXvExtension \ + -DXFree86Server -DXvMCExtension -DSMART_SCHEDULE \ + -DBUILDDEBUG -DXResExtension -DNDEBUG + +# OS_DEFINES +X11FLAGS.OS_DEFINES= -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR \ + -DDDXOSVERRORF -DDDXTIME -DUSB_HID + +.if defined(__MINIX) +X11FLAGS.OS_DEFINES+= -DXOS_USE_NO_LOCKING +.endif # defined(__MINIX) + +.if !(${MACHINE} == "acorn32" || \ + ${MACHINE} == "amiga" || \ + ${MACHINE} == "pmax" || \ + ${MACHINE} == "sun3" || \ + ${MACHINE} == "vax") +# EXT_DEFINES +X11FLAGS.EXTENSION+= -DXF86VIDMODE + +# ServerDefines +X11FLAGS.SERVER+= -DXINPUT -DXFreeXDGA -DXF86VIDMODE +.endif + +.if ${MACHINE_ARCH} == "alpha" || \ + ${MACHINE_ARCH} == "sparc64" || \ + ${MACHINE_ARCH} == "x86_64" +# ServerDefines +X11FLAGS.SERVER+= -D_XSERVER64 +X11FLAGS.EXTENSION+= -D__GLX_ALIGN64 +.endif + +.if ${MACHINE} == "amd64" || \ + ${MACHINE} == "cats" || \ + ${MACHINE} == "i386" || \ + ${MACHINE} == "macppc" || \ + ${MACHINE} == "netwinder" || \ + ${MACHINE} == "ofppc" || \ + ${MACHINE} == "prep" || \ + ${MACHINE} == "sgimips" || \ + ${MACHINE} == "sparc64" || \ + ${MACHINE} == "sparc" || \ + ${MACHINE} == "shark" || \ + ${MACHINE} == "zaurus" +# LOADABLE +X11FLAGS.LOADABLE= -DXFree86LOADER -DIN_MODULE -DXFree86Module \ + ${${ACTIVE_CXX} == "gcc":? -fno-merge-constants :} +.endif + +# XXX FIX ME +XVENDORNAMESHORT= '"X.Org"' +XVENDORNAME= '"The X.Org Foundation"' +XORG_RELEASE= '"Release 1.10.6"' +__XKBDEFRULES__= '"xorg"' +XLOCALE.DEFINES= -DXLOCALEDIR=\"${X11LIBDIR}/locale\" \ + -DXLOCALELIBDIR=\"${X11LIBDIR}/locale\" + +# XXX oh yeah, fix me later +XORG_VERSION_CURRENT="(((1) * 10000000) + ((10) * 100000) + ((6) * 1000) + 0)" + +PRINT_PACKAGE_VERSION= awk '/^PACKAGE_VERSION=/ { \ + match($$1, "([0-9]+\\.)+[0-9]+"); \ + version = substr($$1, RSTART, RLENGTH); \ + } END { print version }' + + +# Commandline to convert 'XCOMM' comments and 'XHASH' to '#', among other +# things. Transformed from the "CppSedMagic" macro from "Imake.rules". +# +X11TOOL_UNXCOMM= ${TOOL_SED} -e '/^\# *[0-9][0-9]* *.*$$/d' \ + -e '/^\#line *[0-9][0-9]* *.*$$/d' \ + -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ + -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ + -e '/^[ ]*XHASH/s/XHASH/\#/' \ + -e '/\@\@$$/s/\@\@$$/\\/' + + +CPPFLAGS+= -DCSRG_BASED -DFUNCPROTO=15 -DNARROWPROTO +CPPFLAGS+= -I${DESTDIR}${X11INCDIR} + +.if ${MACHINE_ARCH} == "x86_64" +CPPFLAGS+= -D__AMD64__ +.endif + +.if !defined(__MINIX) +LDFLAGS+= -Wl,-rpath,${X11USRLIBDIR} -L=${X11USRLIBDIR} +.else +LDFLAGS+= -Wl,-rpath,${X11USRLIBDIR} -L${DESTDIR}${X11USRLIBDIR} +.endif # !defined(__MINIX) + + +# +# .cpp -> "" handling +# CPPSCRIPTS list of files/scripts to run through cpp +# CPPSCRIPTFLAGS extra flags to ${CPP} +# CPPSCRIPTFLAGS_fn extra flags to ${CPP} for file `fn' +# +.if defined(CPPSCRIPTS) # { +.SUFFIXES: .cpp + +.cpp: + ${_MKTARGET_CREATE} + rm -f ${.TARGET} + ${CC} -E -undef -traditional - \ + ${CPPSCRIPTFLAGS_${.TARGET}:U${CPPSCRIPTFLAGS}} \ + < ${.IMPSRC} | ${X11TOOL_UNXCOMM} > ${.TARGET} + +realall: ${CPPSCRIPTS} + +CLEANFILES+= ${CPPSCRIPTS} +.endif # } + +# +# X.Org pkgconfig files handling +# +# PKGCONFIG is expected to contain a list of pkgconfig module names. +# They will produce the files .pc, .pc, etc, to be +# put in X11USRLIBDIR/pkgconfig. +# +# PKGDIST contains the name of a X11SRCDIR subscript where to find the +# source file for the pkgconfig files. +# +# If PKGDIST is not suitable, a consumer can set PKGDIST. with +# the full path to the source file. +# +# Also, the consumer can use PKGDIST alone, and a PKGCONFIG will be +# derived from it. Many times, PKGDIST is capitalized and PKGCONFIG is +# the lower case version. +# + +.if defined(PKGDIST) && !defined(PKGCONFIG) +PKGCONFIG= ${PKGDIST:tl} +.endif +.if defined(PKGCONFIG) && !defined(MLIBDIR) + +.include + +_PKGCONFIG_FILES= ${PKGCONFIG:C/$/.pc/} + +.PHONY: pkgconfig-install +pkgconfig-install: + +realall: ${_PKGCONFIG_FILES:O:u} +realinstall: pkgconfig-install + +.for _pkg in ${PKGCONFIG:O:u} # { + +PKGDIST.${_pkg}?= ${X11SRCDIR.${PKGDIST:U${_pkg}}} +_PKGDEST.${_pkg}= ${DESTDIR}${X11USRLIBDIR}/pkgconfig/${_pkg}.pc + +.PATH: ${PKGDIST.${_pkg}} + +FILESOWN_${_pkg}.pc= ${BINOWN} +FILESGRP_${_pkg}.pc= ${BINGRP} +FILESMODE_${_pkg}.pc= ${NONBINMODE} + +${_PKGDEST.${_pkg}}: ${_pkg}.pc __fileinstall +pkgconfig-install: ${_PKGDEST.${_pkg}} + +# Add a dependancy on the configure file if it exists; this way we +# will rebuild the .pc file if the version in configure changes. +.if exists(${PKGDIST.${_pkg}}/configure) +${_pkg}.pc: ${PKGDIST.${_pkg}}/configure Makefile +.endif + +.endfor # } + +# XXX +# The sed script is very, very ugly. What we actually need is a +# mknative-xorg script that will generate all the .pc files from +# running the autoconfigure script. +# And yes, it has to be split in multiple parts otherwise it's +# too long for sed to handle. + +# hacky transforms: +# @XCBPROTO_VERSION@ + +.SUFFIXES: .pc.in .pc +.pc.in.pc: + ${_MKTARGET_CREATE} + rm -f ${.TARGET} + if [ -n '${PKGCONFIG_VERSION.${.PREFIX}}' ]; then \ + _pkg_version='${PKGCONFIG_VERSION.${.PREFIX}}'; \ + else \ + _pkg_version=$$(${PRINT_PACKAGE_VERSION} \ + ${PKGDIST.${.PREFIX}}/configure); \ + fi; \ + ${TOOL_SED} \ + ${PKGCONFIG_SED_FLAGS} \ + -e "s,@prefix@,${X11ROOTDIR},; \ + s,@INSTALL_DIR@,${X11ROOTDIR},; \ + s,@exec_prefix@,\\$$\{prefix\},; \ + s,@libdir@,\\$$\{prefix\}/lib,; \ + s,@includedir@,\\$$\{prefix\}/include,; \ + s,@datarootdir@,\\$$\{prefix\}/share,; \ + s,@datadir@,\\$$\{datarootdir\},; \ + s,@appdefaultdir@,\\$$\{libdir}/X11/app-defaults,; \ + s,@MAPDIR@,\\$$\{libdir\}/X11/fonts/util,; \ + s,@ICONDIR@,\\$$\{datarootdir\}/icons,; \ + s,@PACKAGE_VERSION@,$${_pkg_version},; \ + s,@VERSION@,$${_pkg_version},; \ + s,@COMPOSITEEXT_VERSION@,$${_pkg_version%.*},; \ + s,@DAMAGEEXT_VERSION@,$${_pkg_version%.*},; \ + s,@FIXESEXT_VERSION@,$${_pkg_version%.*},; \ + s,@RANDR_VERSION@,$${_pkg_version%.*},; \ + s,@RENDER_VERSION@,$${_pkg_version%.*}," \ + -e "s,@LIBS@,,; \ + s,@Z_LIBS@,-lz,; \ + s,@LIBZ@,-lz,; \ + s,@LIBBZ2@,-lbz2,; \ + s,@xkb_base@,\\$$\{prefix\}/lib/X11/xkb,; \ + s,@xcbincludedir@,\\$$\{prefix\}/share/xcb,; \ + s,@fontrootdir@,\\$$\{libdir\}/X11/fonts,; \ + s,@LIBXML2_LIBS@,,; \ + s,@LIBXML2_CFLAGS@,,; \ + s,@ICONV_CFLAGS@,,; \ + s,@ICONV_LIBS@,,; \ + s,@NEEDED@,,; \ + s,@FT2_EXTRA_LIBS@,," \ + -e "s,@moduledir@,\\$$\{libdir\}/modules,; \ + s,@sdkdir@,\\$$\{includedir\}/xorg,; \ + s,@PIXMAN_CFLAGS@,,; \ + s,@LIB_DIR@,/lib,; \ + s,@INSTALL_LIB_DIR@,\\$$\{prefix\}/lib,; \ + s,@INSTALL_INC_DIR@,\\$$\{prefix\}/include,; \ + s,@XKBPROTO_REQUIRES@,kbproto,; \ + s,@XCBPROTO_VERSION@,1.7,; \ + s,@FREETYPE_REQUIRES@,freetype2,; \ + s,@EXPAT_LIBS@,-lexpat,; \ + s,@FREETYPE_LIBS@,-lfreetype,; \ + s,@DEP_CFLAGS@,,; \ + s,@DEP_LIBS@,,; \ + s,@X11_EXTRA_DEPS@,,; \ + s,@XTHREAD_CFLAGS@,-D_REENTRANT,; \ + s,@XTHREADLIB@,-lpthread,; \ + s,@GL_LIB@,GL,; \ + s,@GL_PC_REQ_PRIV@,x11 xext,; \ + s,@GL_PC_LIB_PRIV@,-lm -lpthread,; \ + s,@GL_PC_CFLAGS@,,; \ + s,@GLX_TLS@,no," \ + -e "s,@GLU_LIB@,GLU,; \ + s,@GLU_PC_REQ@,gl,; \ + s,@GLU_PC_REQ_PRIV@,,; \ + s,@GLU_PC_LIB_PRIV@,-lGLU,; \ + s,@GLU_PC_CFLAGS@,,; \ + s,@GLUT_LIB@,glut,; \ + s,@GLUT_PC_REQ_PRIV@,gl glu,; \ + s,@GLUT_PC_LIB_PRIV@,-lglut,; \ + s,@GLUT_PC_CFLAGS@,,; \ + s,@GLW_PC_CFLAGS@,,; \ + s,@GLW_PC_REQ_PRIV@,x11 xt,; \ + s,@GLW_PC_LIB_PRIV@,,; \ + s,@DRI_DRIVER_DIR@,\\$$\{libdir\}/modules/dri,; \ + s,@DRI_PC_REQ_PRIV@,,; \ + s,@GLW_LIB@,GLw,; \ + s,@GBM_PC_REQ_PRIV@,,; \ + s,@GBM_PC_LIB_PRIV@,,; \ + s,@abi_ansic@,0.4,; \ + s,@abi_videodrv@,5.0,; \ + s,@abi_xinput@,4.0,; \ + s,@abi_extension@,2.0,; \ + s,@abi_font@,0.6,; \ + s,@fchown_define@,-DHAS_FCHOWN,; \ + s,@sticky_bit_define@,-DHAS_STICKY_DIR_BIT,;" \ + -e "s,@PKG_CONFIG_LIBS@,${PKG_CONFIG_LIBS},; \ + s,@PACKAGE@,${PKGDIST},; \ + s,@PKGCONFIG_REQUIRES@,${PKGCONFIG_REQUIRES},; \ + s,@PKGCONFIG_REQUIRES_PRIVATELY@,${PKGCONFIG_REQUIRES_PRIVATELY},; \ + s,@ERRORDBDIR@,${X11LIBDIR},; \ + s,@EXPAT_CFLAGS@,,; \ + s,@FREETYPE_CFLAGS@,-I${X11ROOTDIR}/include/freetype2 -I${X11ROOTDIR}/include,;" \ + -e '/^Libs:/ s%-L\([^ ]*\)%-Wl,-rpath,\1 &%g' \ + < ${.IMPSRC} > ${.TARGET}.tmp && \ + mv -f ${.TARGET}.tmp ${.TARGET} + +CLEANFILES+= ${_PKGCONFIG_FILES} ${_PKGCONFIG_FILES:C/$/.tmp/} +.endif + +# +# APPDEFS (app defaults) handling +# +.if defined(APPDEFS) # { +appdefsinstall:: .PHONY ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@} +.PRECIOUS: ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@} + +__appdefinstall: .USE + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \ + ${.ALLSRC} ${.TARGET} + +.for S in ${APPDEFS:O:u} +${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}: ${S} __appdefinstall +.endfor + +realinstall: appdefsinstall +.endif # } + + +# +# .man page handling +# +.if (${MKMAN} != "no" && (${MAN:U} != "" || ${PROG:U} != "")) # { +CLEANDIRFILES+= ${MAN:U${PROG:D${PROG.1}}} +.endif # } + +.SUFFIXES: .man .man.pre .1 .3 .4 .5 .7 + +_X11MANTRANSFORM= \ + __adminmansuffix__ 8 \ + __apploaddir__ ${X11ROOTDIR}/lib/X11/app-defaults \ + __appmansuffix__ 1 \ + __bindir__ ${X11BINDIR} \ + __drivermansuffix__ 4 \ + __filemansuffix__ 5 \ + __LIB_MAN_SUFFIX__ 3 \ + __libmansuffix__ 3 \ + __logdir__ /var/log \ + __mandir__ ${X11MANDIR} \ + __miscmansuffix__ 7 \ + __oslibmansuffix__ 3 \ + __projectroot__ ${X11ROOTDIR} \ + ${X11EXTRAMANTRANSFORMS} + +# Note the escaping trick for _X11MANTRANSFORM using % to replace spaces +XORGVERSION= '"X Version 11"' +X11MANCPP?= no +_X11MANTRANSFORM+= \ + __vendorversion__ ${XORGVERSION:C/ /%/gW} \ + __XCONFIGFILE__ xorg.conf \ + __xconfigfile__ xorg.conf \ + __XCONFIGFILEMAN__ '__XCONFIGFILE__%(__filemansuffix__)' \ + __xorgversion__ ${XORGVERSION:C/ /%/gW} \ + __XSERVERNAME__ Xorg \ + __xservername__ Xorg + +_X11MANTRANSFORMCMD= ${TOOL_SED} -e 's/\\$$/\\ /' ${.IMPSRC} + +.if ${X11MANCPP} != "no" +_X11MANTRANSFORMCMD+= | ${CC} -E -undef -traditional - +. for __def__ __value__ in ${_X11MANTRANSFORM} +_X11MANTRANSFORMCMD+= -D${__def__}=${__value__:C/%/ /gW} +. endfor +.else +_X11MANTRANSFORMCMD+= | ${TOOL_SED} +. for __def__ __value__ in ${_X11MANTRANSFORM} +_X11MANTRANSFORMCMD+= -e s,${__def__},${__value__:C/%/ /gW},g +. endfor +.endif +_X11MANTRANSFORMCMD+= ${X11EXTRAMANDEFS} + +.man.1 .man.3 .man.4 .man.5 .man.7 .man.pre.1 .man.pre.4 .man.pre.5: + ${_MKTARGET_CREATE} + rm -f ${.TARGET} + ${_X11MANTRANSFORMCMD} | ${X11TOOL_UNXCOMM} > ${.TARGET} + +##### Pull in related .mk logic +.include diff --git a/src/sys/i386/fork.c b/src/sys/i386/fork.c index 54541ed..e1249c8 100644 --- a/src/sys/i386/fork.c +++ b/src/sys/i386/fork.c @@ -89,10 +89,7 @@ newProcess->td.vm_dsize = _current->td.vm_dsize; newProcess->td.vm_daddr = _current->td.vm_daddr; - kprintf( "Copying Mem Space! [0x%X:0x%X:0x%X:0x%X:0x%X:%i:%i]\n", newProcess->tss.esp0, newProcess->tss.esp, newProcess->tss.ebp, td->frame->tf_esi, td->frame->tf_eip, newProcess->id, _current->id ); - newProcess->tss.cr3 = (uInt32) vmm_copyVirtualSpace( newProcess->id ); - //kprintf( "Copied Mem Space!\n" ); newProcess->state = FORK; @@ -101,7 +98,6 @@ sched_yield(); /* Return Id of Proccess */ - kprintf("Returning! [%i][0x%X]\n", _current->id,newProcess->tss.cr3); return (newProcess->id); } @@ -125,7 +121,6 @@ /* Set Up New Tasks Information */ memcpy( newProcess->oInfo.cwd, _current->oInfo.cwd, 1024 ); - //kprintf( "Initializing New CWD!\n" ); newProcess->tss.eip = eip; newProcess->oInfo.vmStart = _current->oInfo.vmStart; @@ -165,17 +160,15 @@ newProcess->td.vm_daddr = _current->td.vm_daddr; /* Create A Copy Of The VM Space For New Task */ - kprintf( "Copying Mem Space! [0x%X:0x%X:0x%X:0x%X:0x%X:%i:%i:0x%X]\n", newProcess->tss.esp0, newProcess->tss.esp, newProcess->tss.ebp, esi, eip, newProcess->id, _current->id, newProcess->td.vm_daddr ); newProcess->tss.cr3 = (uInt32) vmm_copyVirtualSpace( newProcess->id ); - //kprintf( "Copied Mem Space!\n" ); newProcess->state = FORK; /* Fix gcc optimization problems */ while ( tmpProcPtr->state == FORK ) sched_yield(); + /* Return Id of Proccess */ - kprintf( "Returning! [%i]", _current->id ); return (newProcess->id); } diff --git a/src/sys/i386/i386_exec.c b/src/sys/i386/i386_exec.c index 9db4cca..a0dc309 100644 --- a/src/sys/i386/i386_exec.c +++ b/src/sys/i386/i386_exec.c @@ -61,7 +61,6 @@ /* Temp Holder */ int sys_execve( struct thread *td, struct sys_execve_args *args ) { int ret = sys_exec( td, args->fname, args->argv, args->envp ); - kprintf("RETURNING: [%i]\n", ret); return (ret); } @@ -191,7 +190,6 @@ /* Now We Must Create A Virtual Space For This Proccess To Run In */ _current->tss.cr3 = (uInt32) vmm_createVirtualSpace( _current->id ); - kprintf( "_current->tss.cr3: 0x%X", _current->tss.cr3 ); /* To Better Load This Application We Will Switch Over To Its VM Space */ asm volatile( "movl %0,%%eax \n" @@ -216,7 +214,6 @@ /* Load ELF Header */ binaryHeader = (elfHeader *) kmalloc( sizeof(elfHeader) ); - //kprintf(">a:%i:0x%X:0x%X<",sizeof(elfHeader),binaryHeader,tmpFd); fread( binaryHeader, sizeof(elfHeader), 1, tmpFd ); /* Check If App Is A Real Application */ @@ -356,7 +353,6 @@ : : "d" ((uInt32 *)(kernelPageDirectory)) ); - kprintf( "execFile Return: %i\n", _current->id ); /* Finally Return */ return; } @@ -518,24 +514,21 @@ } if ((programHeader[i].phFlags & PF_X) && text_size < seg_size) { - kprintf( "setting text: 0x%X - 0x%X\n", seg_addr, seg_size ); text_size = seg_size; text_addr = seg_addr; } else { - kprintf( "setting data: 0x%X - 0x%X\n", seg_addr, seg_size ); data_size = seg_size; data_addr = seg_addr; /* _current->td.vm_dsize = seg_size >> PAGE_SHIFT; _current->td.vm_daddr = (char *) seg_addr; - kprintf( "setting daddr: 0x%X, dsiize: 0x%X\n", _current->td.vm_daddr, _current->td.vm_dsize ); */ } /* * MrOlsen (2016-01-19) NOTE: Note Sure, I should Do This Later - * Thjis is for stack space + * This is for stack space */ _current->oInfo.vmStart = ((programHeader[i].phVaddr & 0xFFFFF000) + 0xA900000); break; @@ -546,11 +539,9 @@ fread( (void *) programHeader[i].phVaddr, programHeader[i].phFilesz, 1, fd ); break; case PT_INTERP: - kprintf( "Malloc: %i\n", programHeader[i].phFilesz ); interp = (char *) kmalloc( programHeader[i].phFilesz ); fseek( fd, programHeader[i].phOffset, 0 ); fread( (void *) interp, programHeader[i].phFilesz, 1, fd ); - kprintf( "Interp: [%s]\n", interp ); ldAddr = ldEnable(); break; case PT_GNU_STACK: @@ -565,8 +556,6 @@ _current->td.vm_dsize = data_size >> PAGE_SHIFT; _current->td.vm_daddr = data_addr; - kprintf( "Done Looping\n" ); - /* What is this doing? 11/23/06 */ if ( elfDynamicS != 0x0 ) { for ( i = 0; i < 12; i++ ) { @@ -580,11 +569,6 @@ tmp[1] = (uInt32) fd; break; } - /* - else { - kprintf("dyn_val: %i",elfDynamicS[i].dynVal); - } - */ } } /* @@ -598,9 +582,7 @@ //MrOlsen (2016-01-12) FIX: Not sure why argv[0] == 0 argc = ((int) argv[0] > 0) ? (int) argv[0] : 1; - kprintf( "argc: %i", argc ); args = (char *) vmmGetFreeVirtualPage( _current->id, 1, VM_TASK ); - kprintf( "argc: %i, args 0x%X", argc, args ); memset( args, 0x0, 0x1000 ); x = 0x0; argvNew = (char **) kmalloc( sizeof(char *) * argc ); diff --git a/src/sys/pci/lnc.c b/src/sys/pci/lnc.c index 97b8ce1..2b36bbc 100644 --- a/src/sys/pci/lnc.c +++ b/src/sys/pci/lnc.c @@ -99,8 +99,6 @@ lnc->nic.ic = lnc_probe(lnc); - //kprintf("ID: %i\n", lnc->nic.ic); - if ((lnc->nic.ic > 0) && (lnc->nic.ic >= PCnet_32)) { lnc->nic.ident = NE2100; lnc->nic.memMode = DMA_FIXED; @@ -111,11 +109,9 @@ /* Extract MAC address from PROM */ for (i = 0; i < ETHER_ADDR_LEN; i++) { lnc->arpcom.ac_enaddr[i] = inportByte(lnc->ioAddr + i); - kprintf("[0x%X]", lnc->arpcom.ac_enaddr[i]); } } else { - kprintf("LNC Init Error\n"); return (-1); } @@ -280,29 +276,18 @@ else { memset(tmpBuf,0x0,sizeof(struct nicBuffer)); } -kprintf("STARTING THREAD LNC"); while (1) { while (lnc_driverOwnsRX(lnc)) { //uint16_t plen = 0 + (uint16_t)lnc->rxRing[lnc->rxPtr].md[2]; int plen = (lnc->rxRing[lnc->rxPtr].md[2] & 0x0fff ) - 4; -/* - if (plen > 0) - kprintf("plen.0: [0x%X]", plen); -*/ tmpBuf->length = plen; tmpBuf->buffer = (void *)(lnc->rxBuffer + (lnc->rxPtr * lnc->bufferSize)); //(char *)kmalloc(length); - // kprintf("RINT2\n"); ethernetif_input(&lnc_netif); - //kprintf("RINT3\n"); - //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); lnc->rxRing[lnc->rxPtr].md[1] = 0x80; - //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); lnc_nextRxPtr(lnc); - //kprintf("RINT-LOOP[%i][0x%X][0x%X]\n", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); } -// kprintf("RINT-DONE[%i][0x%X]\n", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1]); sched_yield(); } diff --git a/src/sys/vmm/paging.c b/src/sys/vmm/paging.c index 80292c0..63c89ef 100644 --- a/src/sys/vmm/paging.c +++ b/src/sys/vmm/paging.c @@ -617,14 +617,6 @@ pageDir = (uint32_t *) PD_BASE_ADDR; - /* - #ifdef DEBUG - */ - kprintf("CVS: [0x%X]\n", addr); - /* - #endif - */ - for (x = (addr / (1024 * 4096)); x < PD_INDEX(VMM_USER_END); x++) { if ((pageDir[x] & PAGE_PRESENT) == PAGE_PRESENT) { pageTableSrc = (uint32_t *) (PT_BASE_ADDR + (0x1000 * x));