xref: /freebsd/share/examples/Makefile (revision d06955f9bdb1416d9196043ed781f9b36dae9adc)
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/diablo-if-net \
140	printing/hpdf \
141	printing/hpif \
142	printing/hpof \
143	printing/hprf \
144	printing/hpvf \
145	printing/if-simple \
146	printing/if-simpleX \
147	printing/ifhp \
148	printing/make-ps-header \
149	printing/netprint \
150	printing/psdf \
151	printing/psdfX \
152	printing/psif \
153	printing/pstf \
154	printing/pstfX \
155	ses/Makefile \
156	ses/Makefile.inc \
157	ses/getencstat/Makefile \
158	ses/getencstat/getencstat.0 \
159	ses/sesd/Makefile \
160	ses/sesd/sesd.0 \
161	ses/setencstat/Makefile \
162	ses/setencstat/setencstat.0 \
163	ses/setobjstat/Makefile \
164	ses/setobjstat/setobjstat.0 \
165	ses/srcs/chpmon.c \
166	ses/srcs/eltsub.c \
167	ses/srcs/eltsub.h \
168	ses/srcs/getencstat.c \
169	ses/srcs/getnobj.c \
170	ses/srcs/getobjmap.c \
171	ses/srcs/getobjstat.c \
172	ses/srcs/inienc.c \
173	ses/srcs/sesd.c \
174	ses/srcs/setencstat.c \
175	ses/srcs/setobjstat.c \
176	scsi_target/Makefile \
177	scsi_target/scsi_target.c \
178	scsi_target/scsi_target.h \
179	scsi_target/scsi_target.8 \
180	scsi_target/scsi_cmds.c \
181	sunrpc/Makefile \
182	sunrpc/dir/Makefile \
183	sunrpc/dir/dir.x \
184	sunrpc/dir/dir_proc.c \
185	sunrpc/dir/rls.c \
186	sunrpc/msg/Makefile \
187	sunrpc/msg/msg.x \
188	sunrpc/msg/msg_proc.c \
189	sunrpc/msg/printmsg.c \
190	sunrpc/msg/rprintmsg.c \
191	sunrpc/sort/Makefile \
192	sunrpc/sort/rsort.c \
193	sunrpc/sort/sort.x \
194	sunrpc/sort/sort_proc.c \
195	uefisign/uefikeys \
196	ypldap/ypldap.conf
197
198BINDIR= ${SHAREDIR}/examples
199
200.if ${MK_HAST} != "no"
201LDIRS+=		hast
202XFILES+=	hast/ucarp.sh \
203		hast/ucarp_down.sh \
204		hast/ucarp_up.sh \
205		hast/vip-down.sh \
206		hast/vip-up.sh
207.endif
208
209.if ${MK_USB} != "no"
210LDIRS+=		libusb20
211XFILES+=	libusb20/Makefile \
212		libusb20/README \
213		libusb20/util.c \
214		libusb20/util.h \
215		libusb20/bulk.c \
216		libusb20/control.c
217.endif
218
219.if ${MACHINE_CPUARCH} == "amd64"
220.if ${MK_BHYVE} != "no"
221LDIRS+=		bhyve
222XFILES+=	bhyve/vmrun.sh
223PACKAGE_bhyve/vmrun.sh=	bhyve
224.endif
225.endif
226
227# Define SHARED to indicate whether you want symbolic links to the system
228# source (``symlinks''), or a separate copy (``copies''); (latter useful
229# in environments where it's not possible to keep /sys publicly readable)
230SHARED?=	copies
231
232beforeinstall: ${SHARED} etc-examples
233META_TARGETS+=	copies symlinks
234.ORDER: ${SHARED} etc-examples
235
236copies:
237.for i in ${LDIRS}
238	if [ -L ${DESTDIR}${BINDIR}/$i ]; then \
239		rm -f ${DESTDIR}${BINDIR}/$i; \
240	fi
241.endfor
242.for file in ${XFILES}
243	${INSTALL} -T package=${PACKAGE_${file}:Uexamples} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \
244		${.CURDIR}/${file} ${DESTDIR}${BINDIR}/${file}
245.endfor
246
247symlinks:
248.for i in ${LDIRS}
249	rm -rf ${DESTDIR}${BINDIR}/$i
250	${INSTALL} ${TAG_ARGS} -l s ${.CURDIR}/$i ${DESTDIR}${BINDIR}/$i
251.endfor
252
253etc-examples:
254.if ${SHARED} != "symlinks"
255	${_+_}(cd ${SRCTOP}/etc; ${MAKE} etc-examples)
256.endif
257
258.if ${SHARED} != "symlinks"
259SUBDIR=	smbfs
260.if ${MK_IPFILTER} != "no"
261SUBDIR+=ipfilter
262.endif
263.if ${MK_PF} != "no"
264SUBDIR+=pf
265.endif
266.endif
267
268HAS_TESTS=
269SUBDIR.${MK_TESTS}+= tests
270
271SUBDIR_PARALLEL=
272
273.include <bsd.prog.mk>
274