xref: /freebsd/share/examples/Makefile (revision 63a938566d524836885917d95bd491aa4400b181)
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	jails/VIMAGE \
80	jails/jail.xxx.conf \
81	jails/jib \
82	jails/jng \
83	jails/rc.conf.jails \
84	jails/rcjail.xxx.conf \
85	kld/Makefile \
86	kld/cdev/Makefile \
87	kld/cdev/README \
88	kld/cdev/module/Makefile \
89	kld/cdev/module/cdev.c \
90	kld/cdev/module/cdev.h \
91	kld/cdev/module/cdevmod.c \
92	kld/cdev/test/Makefile \
93	kld/cdev/test/testcdev.c \
94	kld/dyn_sysctl/Makefile \
95	kld/dyn_sysctl/README \
96	kld/dyn_sysctl/dyn_sysctl.c \
97	kld/firmware/Makefile \
98	kld/firmware/README \
99	kld/firmware/fwconsumer/Makefile \
100	kld/firmware/fwconsumer/fw_consumer.c \
101	kld/firmware/fwimage/Makefile \
102	kld/firmware/fwimage/firmware.img.uu \
103	kld/khelp/Makefile \
104	kld/khelp/README \
105	kld/khelp/h_example.c \
106	kld/syscall/Makefile \
107	kld/syscall/module/Makefile \
108	kld/syscall/module/syscall.c \
109	kld/syscall/test/Makefile \
110	kld/syscall/test/call.c \
111	libvgl/Makefile \
112	libvgl/demo.c \
113	mdoc/POSIX-copyright \
114	mdoc/deshallify.sh \
115	mdoc/example.1 \
116	mdoc/example.3 \
117	mdoc/example.4 \
118	mdoc/example.9 \
119	netgraph/ether.bridge \
120	netgraph/frame_relay \
121	netgraph/ngctl \
122	netgraph/raw \
123	netgraph/udp.tunnel \
124	netgraph/virtual.chain \
125	netgraph/virtual.lan \
126	perfmon/Makefile \
127	perfmon/README \
128	perfmon/perfmon.c \
129	ppi/Makefile \
130	ppi/ppilcd.c \
131	ppp/chap-auth \
132	ppp/login-auth \
133	ppp/ppp.conf.sample \
134	ppp/ppp.conf.span-isp \
135	ppp/ppp.conf.span-isp.working \
136	ppp/ppp.linkdown.sample \
137	ppp/ppp.linkdown.span-isp \
138	ppp/ppp.linkdown.span-isp.working \
139	ppp/ppp.linkup.sample \
140	ppp/ppp.linkup.span-isp \
141	ppp/ppp.linkup.span-isp.working \
142	ppp/ppp.secret.sample \
143	ppp/ppp.secret.span-isp \
144	ppp/ppp.secret.span-isp.working \
145	printing/diablo-if-net \
146	printing/hpdf \
147	printing/hpif \
148	printing/hpof \
149	printing/hprf \
150	printing/hpvf \
151	printing/if-simple \
152	printing/if-simpleX \
153	printing/ifhp \
154	printing/make-ps-header \
155	printing/netprint \
156	printing/psdf \
157	printing/psdfX \
158	printing/psif \
159	printing/pstf \
160	printing/pstfX \
161	ses/Makefile \
162	ses/Makefile.inc \
163	ses/getencstat/Makefile \
164	ses/getencstat/getencstat.0 \
165	ses/sesd/Makefile \
166	ses/sesd/sesd.0 \
167	ses/setencstat/Makefile \
168	ses/setencstat/setencstat.0 \
169	ses/setobjstat/Makefile \
170	ses/setobjstat/setobjstat.0 \
171	ses/srcs/chpmon.c \
172	ses/srcs/eltsub.c \
173	ses/srcs/eltsub.h \
174	ses/srcs/getencstat.c \
175	ses/srcs/getnobj.c \
176	ses/srcs/getobjmap.c \
177	ses/srcs/getobjstat.c \
178	ses/srcs/inienc.c \
179	ses/srcs/sesd.c \
180	ses/srcs/setencstat.c \
181	ses/srcs/setobjstat.c \
182	scsi_target/Makefile \
183	scsi_target/scsi_target.c \
184	scsi_target/scsi_target.h \
185	scsi_target/scsi_target.8 \
186	scsi_target/scsi_cmds.c \
187	sunrpc/Makefile \
188	sunrpc/dir/Makefile \
189	sunrpc/dir/dir.x \
190	sunrpc/dir/dir_proc.c \
191	sunrpc/dir/rls.c \
192	sunrpc/msg/Makefile \
193	sunrpc/msg/msg.x \
194	sunrpc/msg/msg_proc.c \
195	sunrpc/msg/printmsg.c \
196	sunrpc/msg/rprintmsg.c \
197	sunrpc/sort/Makefile \
198	sunrpc/sort/rsort.c \
199	sunrpc/sort/sort.x \
200	sunrpc/sort/sort_proc.c \
201	uefisign/uefikeys \
202	ypldap/ypldap.conf
203
204BINDIR= ${SHAREDIR}/examples
205
206.if ${MK_HAST} != "no"
207LDIRS+=		hast
208XFILES+=	hast/ucarp.sh \
209		hast/ucarp_down.sh \
210		hast/ucarp_up.sh \
211		hast/vip-down.sh \
212		hast/vip-up.sh
213.endif
214
215.if ${MK_USB} != "no"
216LDIRS+=		libusb20
217XFILES+=	libusb20/Makefile \
218		libusb20/README \
219		libusb20/util.c \
220		libusb20/util.h \
221		libusb20/bulk.c \
222		libusb20/control.c
223.endif
224
225.if ${MACHINE_CPUARCH} == "amd64"
226.if ${MK_BHYVE} != "no"
227LDIRS+=		bhyve
228XFILES+=	bhyve/vmrun.sh
229PACKAGE_bhyve/vmrun.sh=	bhyve
230.endif
231.endif
232
233# Define SHARED to indicate whether you want symbolic links to the system
234# source (``symlinks''), or a separate copy (``copies''); (latter useful
235# in environments where it's not possible to keep /sys publicly readable)
236SHARED?=	copies
237
238beforeinstall: ${SHARED} etc-examples
239META_TARGETS+=	copies symlinks
240.ORDER: ${SHARED} etc-examples
241
242copies:
243.for i in ${LDIRS}
244	if [ -L ${DESTDIR}${BINDIR}/$i ]; then \
245		rm -f ${DESTDIR}${BINDIR}/$i; \
246	fi
247.endfor
248.for file in ${XFILES}
249	${INSTALL} -T package=${PACKAGE_${file}:Uexamples} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \
250		${.CURDIR}/${file} ${DESTDIR}${BINDIR}/${file}
251.endfor
252
253symlinks:
254.for i in ${LDIRS}
255	rm -rf ${DESTDIR}${BINDIR}/$i
256	${INSTALL} ${TAG_ARGS} -l s ${.CURDIR}/$i ${DESTDIR}${BINDIR}/$i
257.endfor
258
259etc-examples:
260.if ${SHARED} != "symlinks"
261	${_+_}(cd ${SRCTOP}/etc; ${MAKE} etc-examples)
262.endif
263
264.if ${SHARED} != "symlinks"
265SUBDIR=	smbfs
266.if ${MK_IPFILTER} != "no"
267SUBDIR+=ipfilter
268.endif
269.if ${MK_PF} != "no"
270SUBDIR+=pf
271.endif
272.endif
273
274HAS_TESTS=
275SUBDIR.${MK_TESTS}+= tests
276
277SUBDIR_PARALLEL=
278
279.include <bsd.prog.mk>
280