summaryrefslogtreecommitdiffstats
path: root/src/Makefile
blob: 87c15e799d71fecf4dc1a27cec77017d298a4241 (plain) (blame)
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
CONFIG:=GENERIC.MP
ARCH:=amd64
ROOT!=id -u
.if (${ROOT} != 0)
DOAS:=doas
.endif

build: kernel ifconfig

/usr/src/sbin/ifconfig/ifconfig.c: patches/ifconfig.patch
	patch -uN /usr/src/sbin/ifconfig/ifconfig.c < patches/ifconfig.patch || touch /usr/src/sbin/ifconfig/ifconfig.c

/usr/src/sbin/ifconfig/Makefile: patches/ifconfig_Makefile.patch
	patch -uN /usr/src/sbin/ifconfig/Makefile < patches/ifconfig_Makefile.patch || touch /usr/src/sbin/ifconfig/Makefile

/usr/include/net/if_wg.h: /usr/src/sys/net/if_wg.h
	${DOAS} cp /usr/src/sys/net/if_wg.h /usr/include/net/if_wg.h

.PHONY:
patch_ifconfig: /usr/src/sbin/ifconfig/ifconfig.c /usr/src/sbin/ifconfig/Makefile /usr/include/net/if_wg.h

.PHONY:
ifconfig: patch_ifconfig
	make -C /usr/src/sbin/ifconfig

/usr/src/sbin/sysctl/sysctl.c: patches/sysctl.c.patch
	patch -uN /usr/src/sbin/sysctl/sysctl.c < patches/sysctl.c.patch || touch /usr/src/sbin/sysctl/sysctl.c

.PHONY:
patch_sysctl: /usr/src/sbin/sysctl/sysctl.c

.PHONY:
sysctl: patch_sysctl
	make -C /usr/src/sbin/sysctl

/usr/src/sys/net/if_wg.c: if_wg.c
	cp if_wg.c /usr/src/sys/net/if_wg.c

/usr/src/sys/net/if_wg.h: if_wg.h
	cp if_wg.h /usr/src/sys/net/if_wg.h

/usr/src/sys/net/wireguard.c: wireguard.c
	cp wireguard.c /usr/src/sys/net/wireguard.c

/usr/src/sys/net/wireguard.h: wireguard.h
	cp wireguard.h /usr/src/sys/net/wireguard.h

/usr/src/sys/crypto/blake2s.c: blake2s.c
	cp blake2s.c /usr/src/sys/crypto/blake2s.c

/usr/src/sys/crypto/blake2s.h: blake2s.h
	cp blake2s.h /usr/src/sys/crypto/blake2s.h

/usr/src/sys/crypto/curve25519.c: curve25519.c
	cp curve25519.c /usr/src/sys/crypto/curve25519.c

/usr/src/sys/crypto/curve25519.h: curve25519.h
	cp curve25519.h /usr/src/sys/crypto/curve25519.h

/usr/src/sys/sys/bloombucket.h: bloombucket.h
	cp bloombucket.h /usr/src/sys/sys/bloombucket.h

/usr/src/sys/sys/antireplay.h: antireplay.h
	cp antireplay.h /usr/src/sys/sys/antireplay.h

/usr/src/sys/sys/fixedmap.h: fixedmap.h
	cp fixedmap.h /usr/src/sys/sys/fixedmap.h

/usr/src/sys/sys/mpq.h: mpq.h
	cp mpq.h /usr/src/sys/sys/mpq.h

/usr/src/sys/kern/kern_wg.c: kern_wg.c
	cp kern_wg.c /usr/src/sys/kern/kern_wg.c


/usr/src/sys/conf/GENERIC: patches/CONFIG.patch
	patch -uN /usr/src/sys/conf/GENERIC < patches/CONFIG.patch || touch /usr/src/sys/conf/GENERIC

/usr/src/sys/conf/files: patches/files.patch
	patch -uN /usr/src/sys/conf/files < patches/files.patch || touch /usr/src/sys/conf/files

/usr/src/sys/crypto/chacha_private.h: patches/chacha_private.h.patch
	patch -uN /usr/src/sys/crypto/chacha_private.h < patches/chacha_private.h.patch || touch /usr/src/sys/crypto/chacha_private.h

/usr/src/sys/crypto/chachapoly.h: patches/chachapoly.h.patch
	patch -uN /usr/src/sys/crypto/chachapoly.h < patches/chachapoly.h.patch || touch /usr/src/sys/crypto/chachapoly.h

/usr/src/sys/crypto/chachapoly.c: patches/chachapoly.c.patch
	patch -uN /usr/src/sys/crypto/chachapoly.c < patches/chachapoly.c.patch || touch /usr/src/sys/crypto/chachapoly.c

/usr/src/sys/netinet/in_pcb.h: patches/in_pcb.h.patch
	patch -uN /usr/src/sys/netinet/in_pcb.h < patches/in_pcb.h.patch || touch /usr/src/sys/netinet/in_pcb.h

/usr/src/sys/netinet/udp_usrreq.c: patches/udp_usrreq.c.patch
	patch -uN /usr/src/sys/netinet/udp_usrreq.c < patches/udp_usrreq.c.patch || touch /usr/src/sys/netinet/udp_usrreq.c

/usr/src/sys/kern/uipc_mbuf.c: patches/uipc_mbuf.c.patch
	patch -uN /usr/src/sys/kern/uipc_mbuf.c < patches/uipc_mbuf.c.patch || touch /usr/src/sys/kern/uipc_mbuf.c

/usr/src/sys/sys/mbuf.h: patches/mbuf.h.patch
	patch -uN /usr/src/sys/sys/mbuf.h < patches/mbuf.h.patch || touch /usr/src/sys/sys/mbuf.h

/usr/src/usr.bin/kdump/mkioctls: patches/mkioctls.patch
	patch -uN /usr/src/usr.bin/kdump/mkioctls < patches/mkioctls.patch || touch /usr/src/usr.bin/kdump/mkioctls

/usr/src/usr.bin/kdump/Makefile: patches/kdump_Makefile.patch
	patch -uN /usr/src/usr.bin/kdump/Makefile < patches/kdump_Makefile.patch || touch /usr/src/usr.bin/kdump/Makefile

/usr/src/distrib/sets/lists/comp/mi: patches/comp_mi.patch
	patch -uN /usr/src/distrib/sets/lists/comp/mi < patches/comp_mi.patch || touch /usr/src/distrib/sets/lists/comp/mi

/usr/src/distrib/sets/lists/man/mi: patches/man_mi.patch
	patch -uN /usr/src/distrib/sets/lists/man/mi < patches/man_mi.patch || touch /usr/src/distrib/sets/lists/man/mi

.PHONY:
patch_kernel: /usr/src/sys/net/wireguard.c /usr/src/sys/net/wireguard.h /usr/src/sys/crypto/blake2s.c /usr/src/sys/crypto/blake2s.h /usr/src/sys/crypto/curve25519.c /usr/src/sys/crypto/curve25519.h /usr/src/sys/crypto/chacha_private.h /usr/src/sys/crypto/chachapoly.h /usr/src/sys/crypto/chachapoly.c /usr/src/sys/conf/files /usr/src/sys/conf/GENERIC /usr/src/sys/netinet/in_pcb.h /usr/src/sys/netinet/udp_usrreq.c /usr/src/sys/net/if_wg.c /usr/src/sys/net/if_wg.h /usr/src/sys/sys/bloombucket.h /usr/src/sys/sys/fixedmap.h /usr/src/sys/kern/uipc_mbuf.c /usr/src/sys/sys/mpq.h /usr/src/sys/sys/antireplay.h /usr/src/sys/kern/kern_wg.c

.PHONY:
patch_userspace: /usr/src/usr.bin/kdump/mkioctls /usr/src/usr.bin/kdump/Makefile /usr/src/distrib/sets/lists/comp/mi

.PHONY:
kernel: patch_kernel
	make -C /usr/src/sys/arch/${ARCH}/compile/$(CONFIG)/ obj
	make -C /usr/src/sys/arch/${ARCH}/compile/$(CONFIG)/ config
	make -C /usr/src/sys/arch/${ARCH}/compile/$(CONFIG)/

.PHONY:
clean:
	make -C /usr/src/sys/arch/${ARCH}/compile/$(CONFIG)/ clean
	make -C /usr/src/sbin/ifconfig clean


.PHONY:
install: kernel ifconfig patch_userspace
	${DOAS} make -C /usr/src/sys/arch/${ARCH}/compile/$(CONFIG)/ install
	${DOAS} make -C /usr/src/sbin/ifconfig install
	${DOAS} make -C /usr/src/sbin/sysctl install