xref: /freebsd/share/examples/Makefile (revision 4b330699f819a81d8e34d471225143ffeb321855)
1# $FreeBSD$
2#
3# Doing a make install builds /usr/share/examples
4
5.include <src.opts.mk>
6
7PACKAGE=examples
8FILESDIR=	${SHAREDIR}/examples
9
10.for _XFILE in ${XFILES}
11FILESGROUPS+=	${_XFILE}
12PACKAGE_${_XFILE}?=examples
13${_XFILE}DIR=	${SHAREDIR}/examples/${_XFILE:H}
14.endfor
15
16LDIRS=	BSD_daemon \
17	FreeBSD_version \
18	IPv6 \
19	bootforth \
20	csh \
21	diskless \
22	drivers \
23	etc \
24	find_interface \
25	ibcs2 \
26	indent \
27	ipfw \
28	jails \
29	kld \
30	libvgl \
31	mdoc \
32	netgraph \
33	perfmon \
34	ppi \
35	ppp \
36	printing \
37	ses \
38	scsi_target \
39	sunrpc \
40	uefisign \
41	ypldap
42
43XFILES=	BSD_daemon/FreeBSD.pfa \
44	BSD_daemon/README \
45	BSD_daemon/beastie.eps \
46	BSD_daemon/beastie.fig \
47	BSD_daemon/eps.patch \
48	BSD_daemon/poster.sh \
49	FreeBSD_version/FreeBSD_version.c \
50	FreeBSD_version/Makefile \
51	FreeBSD_version/README \
52	IPv6/USAGE \
53	bootforth/README \
54	bootforth/boot.4th \
55	bootforth/frames.4th \
56	bootforth/loader.rc \
57	bootforth/menu.4th \
58	bootforth/menuconf.4th \
59	bootforth/screen.4th \
60	csh/dot.cshrc \
61	diskless/ME \
62	diskless/README.BOOTP \
63	diskless/README.TEMPLATING \
64	diskless/clone_root \
65	drivers/README \
66	drivers/make_device_driver.sh \
67	drivers/make_pseudo_driver.sh \
68	etc/README.examples \
69	etc/bsd-style-copyright \
70	etc/make.conf \
71	find_interface/Makefile \
72	find_interface/README \
73	find_interface/find_interface.c \
74	ibcs2/README \
75	ibcs2/hello.uu \
76	indent/indent.pro \
77	ipfw/change_rules.sh \
78	jails/README \
79	kld/Makefile \
80	kld/cdev/Makefile \
81	kld/cdev/README \
82	kld/cdev/module/Makefile \
83	kld/cdev/module/cdev.c \
84	kld/cdev/module/cdev.h \
85	kld/cdev/module/cdevmod.c \
86	kld/cdev/test/Makefile \
87	kld/cdev/test/testcdev.c \
88	kld/dyn_sysctl/Makefile \
89	kld/dyn_sysctl/README \
90	kld/dyn_sysctl/dyn_sysctl.c \
91	kld/firmware/Makefile \
92	kld/firmware/README \
93	kld/firmware/fwconsumer/Makefile \
94	kld/firmware/fwconsumer/fw_consumer.c \
95	kld/firmware/fwimage/Makefile \
96	kld/firmware/fwimage/firmware.img.uu \
97	kld/khelp/Makefile \
98	kld/khelp/README \
99	kld/khelp/h_example.c \
100	kld/syscall/Makefile \
101	kld/syscall/module/Makefile \
102	kld/syscall/module/syscall.c \
103	kld/syscall/test/Makefile \
104	kld/syscall/test/call.c \
105	libvgl/Makefile \
106	libvgl/demo.c \
107	mdoc/POSIX-copyright \
108	mdoc/deshallify.sh \
109	mdoc/example.1 \
110	mdoc/example.3 \
111	mdoc/example.4 \
112	mdoc/example.9 \
113	netgraph/ether.bridge \
114	netgraph/frame_relay \
115	netgraph/ngctl \
116	netgraph/raw \
117	netgraph/udp.tunnel \
118	netgraph/virtual.chain \
119	netgraph/virtual.lan \
120	perfmon/Makefile \
121	perfmon/README \
122	perfmon/perfmon.c \
123	ppi/Makefile \
124	ppi/ppilcd.c \
125	ppp/chap-auth \
126	ppp/login-auth \
127	ppp/ppp.conf.sample \
128	ppp/ppp.conf.span-isp \
129	ppp/ppp.conf.span-isp.working \
130	ppp/ppp.linkdown.sample \
131	ppp/ppp.linkdown.span-isp \
132	ppp/ppp.linkdown.span-isp.working \
133	ppp/ppp.linkup.sample \
134	ppp/ppp.linkup.span-isp \
135	ppp/ppp.linkup.span-isp.working \
136	ppp/ppp.secret.sample \
137	ppp/ppp.secret.span-isp \
138	ppp/ppp.secret.span-isp.working \
139	printing/README \
140	printing/diablo-if-net \
141	printing/hpdf \
142	printing/hpif \
143	printing/hpof \
144	printing/hprf \
145	printing/hpvf \
146	printing/if-simple \
147	printing/if-simpleX \
148	printing/ifhp \
149	printing/make-ps-header \
150	printing/netprint \
151	printing/psdf \
152	printing/psdfX \
153	printing/psif \
154	printing/pstf \
155	printing/pstfX \
156	ses/Makefile \
157	ses/Makefile.inc \
158	ses/getencstat/Makefile \
159	ses/getencstat/getencstat.0 \
160	ses/sesd/Makefile \
161	ses/sesd/sesd.0 \
162	ses/setencstat/Makefile \
163	ses/setencstat/setencstat.0 \
164	ses/setobjstat/Makefile \
165	ses/setobjstat/setobjstat.0 \
166	ses/srcs/chpmon.c \
167	ses/srcs/eltsub.c \
168	ses/srcs/eltsub.h \
169	ses/srcs/getencstat.c \
170	ses/srcs/getnobj.c \
171	ses/srcs/getobjmap.c \
172	ses/srcs/getobjstat.c \
173	ses/srcs/inienc.c \
174	ses/srcs/sesd.c \
175	ses/srcs/setencstat.c \
176	ses/srcs/setobjstat.c \
177	scsi_target/Makefile \
178	scsi_target/scsi_target.c \
179	scsi_target/scsi_target.h \
180	scsi_target/scsi_target.8 \
181	scsi_target/scsi_cmds.c \
182	sunrpc/Makefile \
183	sunrpc/dir/Makefile \
184	sunrpc/dir/dir.x \
185	sunrpc/dir/dir_proc.c \
186	sunrpc/dir/rls.c \
187	sunrpc/msg/Makefile \
188	sunrpc/msg/msg.x \
189	sunrpc/msg/msg_proc.c \
190	sunrpc/msg/printmsg.c \
191	sunrpc/msg/rprintmsg.c \
192	sunrpc/sort/Makefile \
193	sunrpc/sort/rsort.c \
194	sunrpc/sort/sort.x \
195	sunrpc/sort/sort_proc.c \
196	uefisign/uefikeys \
197	ypldap/ypldap.conf
198
199BINDIR= ${SHAREDIR}/examples
200
201.if ${MK_HAST} != "no"
202LDIRS+=		hast
203XFILES+=	hast/ucarp.sh \
204		hast/ucarp_down.sh \
205		hast/ucarp_up.sh \
206		hast/vip-down.sh \
207		hast/vip-up.sh
208.endif
209
210.if ${MK_USB} != "no"
211LDIRS+=		libusb20
212XFILES+=	libusb20/Makefile \
213		libusb20/README \
214		libusb20/util.c \
215		libusb20/util.h \
216		libusb20/bulk.c \
217		libusb20/control.c
218.endif
219
220.if ${MACHINE_CPUARCH} == "amd64"
221.if ${MK_BHYVE} != "no"
222LDIRS+=		bhyve
223XFILES+=	bhyve/vmrun.sh
224PACKAGE_bhyve/vmrun.sh=	bhyve
225.endif
226.endif
227
228# Define SHARED to indicate whether you want symbolic links to the system
229# source (``symlinks''), or a separate copy (``copies''); (latter useful
230# in environments where it's not possible to keep /sys publicly readable)
231SHARED?=	copies
232
233beforeinstall: ${SHARED} etc-examples
234META_TARGETS+=	copies symlinks
235.ORDER: ${SHARED} etc-examples
236
237copies:
238.for i in ${LDIRS}
239	if [ -L ${DESTDIR}${BINDIR}/$i ]; then \
240		rm -f ${DESTDIR}${BINDIR}/$i; \
241	fi
242.endfor
243.for file in ${XFILES}
244	${INSTALL} -T package=${PACKAGE_${file}:Uexamples} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \
245		${.CURDIR}/${file} ${DESTDIR}${BINDIR}/${file}
246.endfor
247
248symlinks:
249.for i in ${LDIRS}
250	rm -rf ${DESTDIR}${BINDIR}/$i
251	${INSTALL} ${TAG_ARGS} -l s ${.CURDIR}/$i ${DESTDIR}${BINDIR}/$i
252.endfor
253
254etc-examples:
255.if ${SHARED} != "symlinks"
256	${_+_}(cd ${SRCTOP}/etc; ${MAKE} etc-examples)
257.endif
258
259.if ${SHARED} != "symlinks"
260SUBDIR=	smbfs
261.if ${MK_IPFILTER} != "no"
262SUBDIR+=ipfilter
263.endif
264.if ${MK_PF} != "no"
265SUBDIR+=pf
266.endif
267.endif
268
269SUBDIR.${MK_TESTS}+= tests
270
271SUBDIR_PARALLEL=
272
273.include <bsd.prog.mk>
274