xref: /freebsd/share/examples/Makefile (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
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
42XFILES=	BSD_daemon/FreeBSD.pfa \
43	BSD_daemon/README \
44	BSD_daemon/beastie.eps \
45	BSD_daemon/beastie.fig \
46	BSD_daemon/eps.patch \
47	BSD_daemon/poster.sh \
48	FreeBSD_version/FreeBSD_version.c \
49	FreeBSD_version/Makefile \
50	FreeBSD_version/README \
51	IPv6/USAGE \
52	bootforth/README \
53	bootforth/boot.4th \
54	bootforth/frames.4th \
55	bootforth/loader.rc \
56	bootforth/menu.4th \
57	bootforth/menuconf.4th \
58	bootforth/screen.4th \
59	csh/dot.cshrc \
60	diskless/ME \
61	diskless/README.BOOTP \
62	diskless/README.TEMPLATING \
63	diskless/clone_root \
64	drivers/README \
65	drivers/make_device_driver.sh \
66	drivers/make_pseudo_driver.sh \
67	etc/README.examples \
68	etc/bsd-style-copyright \
69	etc/make.conf \
70	find_interface/Makefile \
71	find_interface/README \
72	find_interface/find_interface.c \
73	ibcs2/README \
74	ibcs2/hello.uu \
75	indent/indent.pro \
76	ipfw/change_rules.sh \
77	jails/README \
78	kld/Makefile \
79	kld/cdev/Makefile \
80	kld/cdev/README \
81	kld/cdev/module/Makefile \
82	kld/cdev/module/cdev.c \
83	kld/cdev/module/cdev.h \
84	kld/cdev/module/cdevmod.c \
85	kld/cdev/test/Makefile \
86	kld/cdev/test/testcdev.c \
87	kld/dyn_sysctl/Makefile \
88	kld/dyn_sysctl/README \
89	kld/dyn_sysctl/dyn_sysctl.c \
90	kld/firmware/Makefile \
91	kld/firmware/README \
92	kld/firmware/fwconsumer/Makefile \
93	kld/firmware/fwconsumer/fw_consumer.c \
94	kld/firmware/fwimage/Makefile \
95	kld/firmware/fwimage/firmware.img.uu \
96	kld/khelp/Makefile \
97	kld/khelp/README \
98	kld/khelp/h_example.c \
99	kld/syscall/Makefile \
100	kld/syscall/module/Makefile \
101	kld/syscall/module/syscall.c \
102	kld/syscall/test/Makefile \
103	kld/syscall/test/call.c \
104	libvgl/Makefile \
105	libvgl/demo.c \
106	mdoc/POSIX-copyright \
107	mdoc/deshallify.sh \
108	mdoc/example.1 \
109	mdoc/example.3 \
110	mdoc/example.4 \
111	mdoc/example.9 \
112	netgraph/ether.bridge \
113	netgraph/frame_relay \
114	netgraph/ngctl \
115	netgraph/raw \
116	netgraph/udp.tunnel \
117	netgraph/virtual.chain \
118	netgraph/virtual.lan \
119	perfmon/Makefile \
120	perfmon/README \
121	perfmon/perfmon.c \
122	ppi/Makefile \
123	ppi/ppilcd.c \
124	ppp/chap-auth \
125	ppp/login-auth \
126	ppp/ppp.conf.sample \
127	ppp/ppp.conf.span-isp \
128	ppp/ppp.conf.span-isp.working \
129	ppp/ppp.linkdown.sample \
130	ppp/ppp.linkdown.span-isp \
131	ppp/ppp.linkdown.span-isp.working \
132	ppp/ppp.linkup.sample \
133	ppp/ppp.linkup.span-isp \
134	ppp/ppp.linkup.span-isp.working \
135	ppp/ppp.secret.sample \
136	ppp/ppp.secret.span-isp \
137	ppp/ppp.secret.span-isp.working \
138	printing/README \
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
197BINDIR= ${SHAREDIR}/examples
198
199.if ${MK_HAST} != "no"
200LDIRS+=		hast
201XFILES+=	hast/ucarp.sh \
202		hast/ucarp_down.sh \
203		hast/ucarp_up.sh \
204		hast/vip-down.sh \
205		hast/vip-up.sh
206.endif
207
208.if ${MK_USB} != "no"
209LDIRS+=		libusb20
210XFILES+=	libusb20/Makefile \
211		libusb20/README \
212		libusb20/util.c \
213		libusb20/util.h \
214		libusb20/bulk.c \
215		libusb20/control.c
216.endif
217
218.if ${MACHINE_CPUARCH} == "amd64"
219.if ${MK_BHYVE} != "no"
220LDIRS+=		bhyve
221XFILES+=	bhyve/vmrun.sh
222PACKAGE_bhyve/vmrun.sh=	bhyve
223.endif
224.endif
225
226# Define SHARED to indicate whether you want symbolic links to the system
227# source (``symlinks''), or a separate copy (``copies''); (latter useful
228# in environments where it's not possible to keep /sys publicly readable)
229SHARED?=	copies
230
231beforeinstall: ${SHARED} etc-examples
232META_TARGETS+=	copies symlinks
233.ORDER: ${SHARED} etc-examples
234
235copies:
236.for i in ${LDIRS}
237	if [ -L ${DESTDIR}${BINDIR}/$i ]; then \
238		rm -f ${DESTDIR}${BINDIR}/$i; \
239	fi
240.endfor
241	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
242	    -f ${.CURDIR}/../../etc/mtree/BSD.usr.dist -p ${DESTDIR}/usr
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	ln -s ${.CURDIR}/$i ${DESTDIR}${BINDIR}/$i
252.endfor
253
254etc-examples:
255.if ${SHARED} != "symlinks"
256	${_+_}(cd ${.CURDIR}/../../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
269.if ${MK_TESTS} != "no"
270SUBDIR+=tests
271.endif
272
273SUBDIR_PARALLEL=
274
275.include <bsd.prog.mk>
276