-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
154 lines (137 loc) · 4.97 KB
/
Makefile
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# -*- makefile-bsdmake -*-
#
# Makefile - of the BSD variety
#
# (on older Mac OS X, use "bsdmake"; on macOS install "bmake")
#
# Use "LDLIBS+=-llibrary" or "LDLIBS+='-L/usr/pkg/lib -llibrary'" to add
# libraries to the command line (do not use LDFLAGS on the command line, though
# it can be set in the environment)
#
# Use "CPPFLAGS+=-flags" to add CC flags (do not use CFLAGS on the command line,
# though it can be set in the environment)
#
# Use "CPPFLAGS+=-S -o -" with a ".o" target to see assembler
#
# Use "CSTD=c89 CPPFLAGS+='-pedantic'" to set a specific C standard.
#
# Use "OPTIM=-O0" to set the optimizer level
#
# Use "DBG=-g3" to set the debugger level for GCC
#
# Use "PEDANTIC=no" to turn off '-pedantic'
#
# See also "Makefile.compiler", e.g. for sanitizer options.
# This Makefile works with NetBSD Make, OSX bsdmake, Pkgsrc bmake (on OSX/Darwin
# one must set "SHLIB_MAJOR= SHLIB_MINOR= SHLIB_TEENY=" because Pkgsrc's
# bootstrap-mk-files (as of 20160411) are not yet fully ported to OSX/Darwin),
# and Simon Gerraty's Bmake & Mk-files from http://www.crufy.net/FreeWare/.
#
# Pkgsrc will install on a vast number of systems, including MS-Windows with
# Cygwin. Simon's Bmake works on many Unix-like systems.
# You can define USE_UBSAN or USE_ASAN on the command line to enable the
# Undefined or Address sanitizers with recent enough Clang or GCC. Note if your
# system supports these you may of course use its way of enabling them instead
# (e.g. on NetBSD set "MKSANITIZER=yes USE_SANITIZER=address").
#
# N.B.: The address sanitizer is not available when the PaX ASLR (Address Space
# Layout Randomization) feature is enabled on a given system, but it can be
# disabled for a given binary with paxctl(8): paxctl +a ${prog}
.if exists(/usr/share/mk/bsd.own.mk) || \
exists(/usr/pkg/share/mk/bsd.own.mk) || \
exists(/usr/pkg/share/mk/bsdmake/bsd.own.mk) || \
exists(/usr/local/share/mk/bsd.own.mk) || \
exists(/usr/local/share/mk/bsdmake/bsd.own.mk)
. include <bsd.own.mk>
.endif
# experiments should be pedantic!
#
.if !defined(PEDANTIC) || ${PEDANTIC} != "no"
CWARNFLAGS += -pedantic
.endif
.include "Makefile.compiler"
.if defined(_HOST_OSNAME)
TARGET_OSNAME?= ${_HOST_OSNAME}
.endif
# this will only have effect on some BSDs, not Darwin/OSX/macOS, nor FreeBSD,
# and it is added to LDFLAGS by the system mk-files (sys.mk in general, but also
# <bsd.prog.mk> sometimes. Note that some of the sanitizers don't work when
# static-linked.
#
.if ((defined(TARGET_OSNAME) && (${TARGET_OSNAME} == "Darwin")) || \
(defined(OS) && (${OS} == "Darwin")) || \
(defined(.FreeBSD) && (empty(.FreeBSD) || (${.FreeBSD} == "false"))))
#
# NOTE: Mac OS X does not support static linking
#
.else
LDSTATIC ?= -static
.endif
# but this will work....
.if (defined(TARGET_OSNAME) && (${TARGET_OSNAME} == "Darwin")) || defined(.FreeBSD)
# for both FreeBSD and Mac OS X....
NO_SHARED = YES
.else
NOSHARED = YES
.endif
# This is so we can use <bsd.prog.mk> without any manual page. Note though that
# PROG is never defined -- this Makefile is intended to build a single program
# specified as the target on its command line.
#
MAN = # empty
.if exists(/usr/share/mk/bsd.prog.mk) || \
exists(/usr/pkg/share/mk/bsd.prog.mk) || \
exists(/usr/pkg/share/mk/bsdmake/bsd.prog.mk) || \
exists(/opt/pkg/share/mk/bsd.prog.mk) || \
exists(/usr/local/share/mk/bsd.prog.mk) || \
exists(/usr/local/share/mk/bsdmake/bsd.prog.mk)
. include <bsd.prog.mk>
.endif
# add patterns for our extra languages
#
PATTERNS ?= Makefile CStandard.c g*.c t*.awk t*.[ch] t*.c++ t*.sh t*.clisp t*.mk t*.go go.mod go.sum
.if ((defined(TARGET_OSNAME) && (${TARGET_OSNAME} == "Darwin")) || \
(defined(OS) && (${OS} == "Darwin")) || \
(defined(.FreeBSD) && (empty(.FreeBSD) || (${.FreeBSD} == "false"))))
#
# xxx does Clang make .dSYM directories on FreeBSD too???
#
clean: macos-clean-dSYM
macos-clean-dSYM: .PHONY
rm -rf ${PROG}.dSYM
.endif
#DEST_RSH_HOSTS ?= historically.local
DEST_OpenSSH_HOSTS ?= very.local central.weird.com # freebsd.local mail.reptiles.org
#DEST_KLERVI_HOSTS ?= faraday.klervi.com lithium.local
# seems to be a default target in <bsd.subdir.mk> on OSX (& FreeBSD?)
#
publish: .PHONY
.for host in ${DEST_RSH_HOSTS}
rsync -Ict --stats -e rsh ${PATTERNS} ${host}:src
.endfor
.for host in ${DEST_OpenSSH_HOSTS}
rsync -Ict --stats -e ssh ${PATTERNS} ${host}:src
.endfor
.for host in ${DEST_KLERVI_HOSTS}
rsync -Ict --stats -e "ssh -l gaw" ${PATTERNS} ${host}:src
.endfor
distribute: .PHONY
distribute: publish
CHOST ?= central.weird.com
# reverse tunnel:
#
# cat >rsyncd.conf <<'__EOF__' \
# [src] \
# use chroot = false \
# read only = false \
# path = . \
# __EOF__
#
rpull: .PHONY
rsync --no-detach --daemon --address 127.0.0.1 --port=22222 --config=./rsyncd.conf & \
ssh -R 127.0.0.1:22222:127.0.0.1:22222 -l woods ${CHOST} 'cd src && rsync --stats --port=22222 ${PATTERNS} 127.0.0.1::src'; \
kill $$!
pull: .PHONY
.for pattern in ${PATTERNS}
rsync -Ict --stats -e "ssh -l woods" ${CHOST}:src/${pattern} ./
.endfor