-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.end
101 lines (85 loc) · 3.7 KB
/
Makefile.end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# -*- makefile-bsdmake -*-
#
# This should be included at the top of your Makefile
#
# Copyright (C) 2019 Greg A. Woods - This work is licensed under the Creative
# Commons Attribution-ShareAlike 4.0 International License. To view a copy of
# the license, visit <URL:http://creativecommons.org/licenses/by-sa/4.0/>, or
# send a letter to: Creative Commons, PO Box 1866, Mountain View, CA 94042, USA
#
# The rest is just default boilerplate for stand-alone builds....
# XXX this is a very crude hack -- but the only real fix is probably to wait for
# everyone to pick up <auto.obj.mk> so this can just use MKOBJDIRS=auto...
#
bmake-test-obj: .PHONY bmake-do-obj
@if [ $$(pwd) = ${.CURDIR:Q} -a ! -z "${MAKEOBJDIRPREFIX}" -a ! -d "${MAKEOBJDIRPREFIX}" ]; then echo "You must create ${MAKEOBJDIRPREFIX} first!"; false; fi
# XXX because simple projects use <bsd.prog.mk> at a top level, we must have the
# ${.OBJDIR} present __BEFORE__ make is run since make will try to chdir(2) to
# ${.OBJDIR} before doing anything else, but if that doesn't exist then it will
# simply stay in ${.CURDIR} to run commands.... However we can have this depend
# on bmake-test-obj and thus that's dependency on bmake-do-obj will cause "obj"
# to be made and the user can just run "MAKEOBJDIRPREFIX=build make" again and
# everything will finally procede in the right ${.OBJDIR}.
#
bmake-test-obj-again: .PHONY bmake-test-obj
@if [ $$(pwd) = ${.CURDIR:Q} ]; then echo "Not yet working in ${MAKEOBJDIRPREFIX:U'objdir'}, try again!"; false; fi
.for targ in ${BUILDTARGETS:S/.WAIT//g}
${targ}: .PHONY ${targ:S/bmake-do-//}
.endfor
# most implementations do not make 'regress' depend on first building everything
# but we need to build everything before we can do any testing
#
regress: .PHONY all
# For stand-alone build & install we will also need to make the installation
# directories:
#
bmake_install_dirs += ${BINDIR}
bmake_install_dirs += ${INCSDIR}
bmake_install_dirs += ${LIBDIR}
bmake_install_dirs += ${PKGCONFIGDIR}
# the DEBUGDIR ones could/should maybe depend on MKDEBUGLIB
bmake_install_dirs += ${DEBUGDIR}
bmake_install_dirs += ${DEBUGDIR}/${PREFIX}/bin
bmake_install_dirs += ${DOCDIR}/${PACKAGE}
bmake_install_dirs += ${MANDIR}
bmake_install_dirs += ${MANDIR}/man1
# (in general though it is safest to always make them all)
beforeinstall: _bmake_install_dirs
# many BSD system mk files will not make directories on demand
_bmake_install_dirs: .PHONY
.for instdir in ${bmake_install_dirs}
${INSTALL} -d ${DESTDIR}${instdir}
.endfor
afterinstall: .PHONY install-docs
install-docs: .PHONY beforeinstall .WAIT docs
.for docfile in ${DOCS}
cp ${.CURDIR:Q}/${docfile} ${DESTDIR}${SHAREDIR}/doc/${PACKAGE}/
.endfor
-cp -R $(MAKEOBJDIRPREFIX:Q)/man ${DESTDIR}${SHAREDIR}/
#SRCINSTDIR ?= ${BSDSRCDIR}/${BINDIR:S/\//./g}
SRCINSTDIR ?= ${BSDSRCDIR}/libexec
#SRCUPDATEDIR?= ${SRCINSTDIR}/${.CURDIR:C/.*\///}
SRCUPDATEDIR ?= ${SRCINSTDIR}/${PACKAGE_NAME}
RCS_ID_EDITS = -E -e 's/\$$Name: ([^$$]*)\$$/\1/' \
-e 's/\$$Id: ([^$$]*)\$$/\1/'
${PACKAGE_NAME}-to-netbsd: .PHONY ${SRCS} ${HEADERS} ${DOCS} ${MAN} ${OTHER}
${INSTALL_DIR} ${SRCUPDATEDIR}
.for _file_ in ${SRCS} ${HEADERS} ${DOCS} ${MAN} ${OTHER}
rm -f ${SRCUPDATEDIR}/${_file_}
sed ${RCS_ID_EDITS} < ${_file_} > ${SRCUPDATEDIR}/${_file_}
chmod ${FILESMODE} ${SRCUPDATEDIR}/${_file_}
.endfor
TMPDIR ?= ${HOME}/tmp
TARBASE ?= ${PACKAGE_NAME}-${PACKAGE_VERSION}
${TARBASE}: .PHONY
pax -wvz -s '|^|$@/|' -f ${TMPDIR}/$@.tar.gz *
tar: .PHONY ${TARBASE}
# finally include the compiler settings helpers
#
.include "${.CURDIR}/Makefile.compiler"
#
# Local Variables:
# eval: (make-local-variable 'compile-command)
# compile-command: (concat "mkdir -p build; MAKEOBJDIRPREFIX=$(pwd)/build " (default-value 'compile-command))
# End:
#