xref: /trueos/include/Makefile (revision 9c1dde6c551c2fcfdb84a29c80e2a77eff789c59)
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD$
3#
4# Doing a "make install" builds /usr/include.
5
6.include <bsd.own.mk>
7
8CLEANFILES= osreldate.h version vers.c
9SUBDIR= arpa mach mach_debug protocols rpcsvc rpc xlocale
10INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
11	db.h \
12	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13	fts.h ftw.h getopt.h glob.h grp.h \
14	ieeefp.h ifaddrs.h \
15	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
16	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
17	ndbm.h netconfig.h \
18	netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \
19	printf.h proc_service.h pthread.h \
20	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \
21	res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
22	signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \
23	stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \
24	strings.h sysexits.h tar.h termios.h tgmath.h \
25	time.h timeconv.h timers.h ttyent.h \
26	uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \
27	wchar.h wctype.h wordexp.h xlocale.h
28
29# APSL headers
30INCS+=	Availability.h \
31	AvailabilityInternal.h \
32	AvailabilityMacros.h \
33	CrashReporterClient.h \
34	MacTypes.h \
35	NSSystemDirectories.h \
36	TargetConditionals.h \
37	_simple.h \
38	_types.h \
39	aliasdb.h \
40	ils.h \
41	libinfo.h \
42	si_data.h \
43	si_module.h \
44	util.h \
45	utmp.h
46
47SUBDIR+= apple gen libkern os servers
48
49.PATH: ${.CURDIR}/../contrib/libc-vis
50INCS+=	vis.h
51
52MHDRS=	float.h floatingpoint.h stdarg.h
53
54PHDRS=	sched.h _semaphore.h
55
56LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
57	syslog.h ucontext.h
58
59LDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
60	netipsec ${_netipx} netnatm netsmb \
61	nfs nfsclient nfsserver \
62	sys vm
63
64LSUBDIRS=	cam/ata cam/scsi \
65	dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
66	dev/hwpmc \
67	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
68	dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
69	dev/speaker dev/utopia dev/vkbd dev/wi \
70	fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
71	fs/procfs fs/smbfs fs/udf fs/unionfs \
72	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
73	geom/mirror geom/mountver geom/multipath geom/nop \
74	geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \
75	netgraph/atm netgraph/netflow \
76	security/audit \
77	security/mac_biba security/mac_bsdextended security/mac_lomac \
78	security/mac_mls security/mac_partition \
79	ufs/ffs ufs/ufs \
80	sys/mach sys/mach_debug
81
82LSUBSUBDIRS=	dev/mpt/mpilib sys/mach/ipc sys/mach/device
83
84.if ${MK_BLUETOOTH} != "no"
85LSUBSUBDIRS+=	netgraph/bluetooth/include
86.endif
87
88.if ${MK_GPIB} != "no"
89_dev_ieee488=	dev/ieee488
90.endif
91
92.if ${MK_GSSAPI} != "no"
93SUBDIR+=	gssapi
94INCS+=		gssapi.h
95.endif
96
97.if ${MK_HESIOD} != "no"
98INCS+=	hesiod.h
99.endif
100
101# XXX unconditionally needed by <netsmb/netbios.h>
102#.if ${MK_IPX} != "no"
103_netipx=	netipx
104#.endif
105
106# Handle the #define aliases for libiconv
107.if ${MK_ICONV} == "yes"
108INCS+=		iconv.h
109.endif
110
111.if ${MK_USB} != "no"
112LSUBDIRS+=	dev/usb
113.endif
114
115.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
116_dev_powermac_nvram=	dev/powermac_nvram
117.endif
118
119# Define SHARED to indicate whether you want symbolic links to the system
120# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
121# probably only useful for developers and should be avoided if you do not
122# wish to tie your /usr/include and /usr/src together.
123#SHARED=	symlinks
124SHARED?=	copies
125
126INCS+=	osreldate.h
127
128SYSDIR=			${.CURDIR}/../sys
129NEWVERS_SH=		${SYSDIR}/conf/newvers.sh
130PARAM_H=		${SYSDIR}/sys/param.h
131MK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
132
133osreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
134	env ECHO="${ECHO}" \
135	    MAKE="${MAKE}" \
136	    NEWVERS_SH=${NEWVERS_SH} \
137	    PARAM_H=${PARAM_H} \
138	    SYSDIR=${SYSDIR} \
139	    sh ${MK_OSRELDATE_SH}
140
141.for i in ${LHDRS}
142INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
143.endfor
144.for i in ${MHDRS}
145INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
146.endfor
147.for i in ${PHDRS}
148INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
149.endfor
150
151.if ${MACHINE} != ${MACHINE_CPUARCH}
152_MARCHS=	${MACHINE_CPUARCH}
153.endif
154.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
155_MARCHS+=	x86
156.endif
157
158.include <bsd.prog.mk>
159
160installincludes: ${SHARED}
161${SHARED}: compat
162
163# Take care of stale directory-level symlinks.
164compat:
165.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
166	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
167		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
168	fi
169.endfor
170	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
171	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
172	    -p ${DESTDIR}${INCLUDEDIR}
173
174copies:
175.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc machine/mach \
176	${_MARCHS}
177.if exists(${DESTDIR}${INCLUDEDIR}/$i)
178	cd ${DESTDIR}${INCLUDEDIR}/$i; \
179	for h in *.h; do \
180		if [ -L $$h ]; then rm -f $$h; fi; \
181	done
182.endif
183.endfor
184.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
185	cd ${.CURDIR}/../sys; \
186	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
187	    ${DESTDIR}${INCLUDEDIR}/$i
188.endfor
189	cd ${.CURDIR}/../sys/dev/acpica; \
190	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
191	    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
192	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
193	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
194	cd ${.CURDIR}/../sys/dev/agp; \
195	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
196	    ${DESTDIR}${INCLUDEDIR}/dev/agp
197	cd ${.CURDIR}/../sys/dev/bktr; \
198	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
199	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
200.if ${MK_NAND} != "no"
201	cd ${.CURDIR}/../sys/dev/nand; \
202	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
203	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
204	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
205	    ${DESTDIR}${INCLUDEDIR}/dev/nand
206.endif
207	cd ${.CURDIR}/../sys/dev/pci; \
208	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
209	    ${DESTDIR}${INCLUDEDIR}/dev/pci
210	cd ${.CURDIR}/../sys/contrib/altq/altq; \
211	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
212	    ${DESTDIR}${INCLUDEDIR}/altq
213	cd ${.CURDIR}/../sys/fs/cd9660/; \
214	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
215	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
216.if ${MK_IPFILTER} != "no"
217	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
218	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
219	    ${DESTDIR}${INCLUDEDIR}/netinet
220.endif
221.if ${MK_PF} != "no"
222	cd ${.CURDIR}/../sys/netpfil/pf; \
223	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
224	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
225.endif
226	cd ${.CURDIR}/../sys/crypto; \
227	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
228	    ${DESTDIR}${INCLUDEDIR}/crypto
229	cd ${.CURDIR}/../sys/opencrypto; \
230	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
231	    ${DESTDIR}${INCLUDEDIR}/crypto
232	cd ${.CURDIR}/../sys/${MACHINE}/include; \
233	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
234	    ${DESTDIR}${INCLUDEDIR}/machine
235.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
236	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
237	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
238	    ${DESTDIR}${INCLUDEDIR}/machine/pc
239.endif
240.for _MARCH in ${_MARCHS}
241.if exists(${.CURDIR}/../sys/${_MARCH}/include)
242	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
243	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
244	cd ${.CURDIR}/../sys/${_MARCH}/include; \
245	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
246	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
247.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
248	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
249	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
250	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
251	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
252	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
253.endif
254.endif
255.endfor
256	cd ${.CURDIR}/../sys/rpc; \
257	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
258	    ${DESTDIR}${INCLUDEDIR}/rpc
259	cd ${.CURDIR}/../sys/teken; \
260	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
261	    ${DESTDIR}${INCLUDEDIR}/teken
262.if exists(${.CURDIR}/../sys/sys/mach)
263	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
264		${DESTDIR}${INCLUDEDIR}/sys/mach
265	cd ${.CURDIR}/../sys/sys/mach ; \
266	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h *.defs \
267		${DESTDIR}${INCLUDEDIR}/sys/mach
268.endif
269.if exists(${.CURDIR}/../sys/sys/mach/ipc)
270	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
271		${DESTDIR}${INCLUDEDIR}/sys/mach/ipc
272	cd ${.CURDIR}/../sys/sys/mach/ipc ; \
273	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
274		${DESTDIR}${INCLUDEDIR}/sys/mach/ipc
275.endif
276.if exists(${.CURDIR}/../sys/sys/mach_debug)
277	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
278		${DESTDIR}${INCLUDEDIR}/sys/mach_debug
279	cd ${.CURDIR}/../sys/sys/mach_debug ; \
280		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h *.defs \
281		${DESTDIR}${INCLUDEDIR}/sys/mach_debug
282.endif
283.if exists(${.CURDIR}/../sys/sys/mach/device)
284	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
285		${DESTDIR}${INCLUDEDIR}/sys/mach/device
286	cd ${.CURDIR}/../sys/sys/mach/device ; \
287		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h *.defs \
288		${DESTDIR}${INCLUDEDIR}/sys/mach/device
289.endif
290
291symlinks:
292	@${ECHO} "Setting up symlinks to kernel source tree..."
293	mkdir -p ${DESTDIR}${INCLUDEDIR}/apple/System
294	ln -fs ../sys ${DESTDIR}${INCLUDEDIR}/apple/System/sys
295.for i in ${LDIRS}
296	cd ${.CURDIR}/../sys/$i; \
297	for h in *.h; do \
298		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
299	done
300.endfor
301.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
302	cd ${.CURDIR}/../sys/$i; \
303	for h in *.h; do \
304		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
305	done
306.endfor
307	cd ${.CURDIR}/../sys/dev/acpica; \
308	for h in acpiio.h acpi_hpet.h; do \
309		ln -fs ../../../../sys/dev/acpica/$$h \
310		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
311	done
312	cd ${.CURDIR}/../sys/dev/agp; \
313	for h in agpreg.h; do \
314		ln -fs ../../../../sys/dev/agp/$$h \
315		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
316	done
317	cd ${.CURDIR}/../sys/dev/bktr; \
318	for h in ioctl_*.h; do \
319		ln -fs ../../../../sys/dev/bktr/$$h \
320		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
321	done
322.if ${MK_NAND} != "no"
323	cd ${.CURDIR}/../sys/dev/nand; \
324	for h in nandsim.h nand_dev.h; do \
325		ln -fs ../../../../sys/dev/nand/$$h \
326		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
327	done
328.endif
329	cd ${.CURDIR}/../sys/dev/pci; \
330	for h in pcireg.h; do \
331		ln -fs ../../../../sys/dev/pci/$$h \
332		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
333	done
334.for i in ${LSUBSUBDIRS}
335	cd ${.CURDIR}/../sys/$i; \
336	for h in *.h; do \
337		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
338	done
339.endfor
340	cd ${.CURDIR}/../sys/contrib/altq/altq; \
341	for h in *.h; do \
342		ln -fs ../../../sys/contrib/altq/altq/$$h \
343		    ${DESTDIR}${INCLUDEDIR}/altq; \
344	done
345.if ${MK_IPFILTER} != "no"
346	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
347	for h in *.h; do \
348		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
349		    ${DESTDIR}${INCLUDEDIR}/netinet; \
350	done
351.endif
352.if ${MK_PF} != "no"
353	cd ${.CURDIR}/../sys/netpfil/pf; \
354	for h in *.h; do \
355		ln -fs ../../../../sys/netpfil/pf/$$h \
356		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
357	done
358.endif
359	cd ${.CURDIR}/../sys/crypto; \
360	for h in rijndael/rijndael.h; do \
361		ln -fs ../../../sys/crypto/$$h \
362		    ${DESTDIR}${INCLUDEDIR}/crypto; \
363	done
364	cd ${.CURDIR}/../sys/opencrypto; \
365	for h in *.h; do \
366		ln -fs ../../../sys/opencrypto/$$h \
367		    ${DESTDIR}${INCLUDEDIR}/crypto; \
368	done
369	cd ${.CURDIR}/../sys/${MACHINE}/include; \
370	for h in *.h; do \
371		ln -fs ../../../sys/${MACHINE}/include/$$h \
372		    ${DESTDIR}${INCLUDEDIR}/machine; \
373	done
374.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
375	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
376	for h in *.h; do \
377		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
378		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
379	done
380.endif
381.if exists(${.CURDIR}/../sys/${MACHINE}/include/mach)
382	cd ${.CURDIR}/../sys/${MACHINE}/include/mach; \
383	for h in *.h; do \
384		ln -fs ../../../../sys/${MACHINE}/include/mach/$$h \
385		    ${DESTDIR}${INCLUDEDIR}/machine/mach; \
386	done
387	for d in *.defs; do \
388		ln -fs ../../../../sys/${MACHINE}/include/mach/$$d \
389		    ${DESTDIR}${INCLUDEDIR}/machine/mach; \
390	done
391
392.endif
393.for _MARCH in ${_MARCHS}
394.if exists(${.CURDIR}/../sys/${_MARCH}/include)
395	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
396	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
397	cd ${.CURDIR}/../sys/${_MARCH}/include; \
398	for h in *.h; do \
399		ln -fs ../../../sys/${_MARCH}/include/$$h \
400		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
401	done
402.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
403	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
404	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
405	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
406	for h in *.h; do \
407		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
408		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
409	done
410.endif
411.endif
412.endfor
413	cd ${.CURDIR}/../sys/fs/cd9660; \
414	for h in *.h; do \
415		ln -fs ../../../../sys/fs/cd9660/$$h \
416		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
417	done
418	cd ${.CURDIR}/../sys/rpc; \
419	for h in types.h; do \
420		ln -fs ../../../sys/rpc/$$h \
421		    ${DESTDIR}${INCLUDEDIR}/rpc; \
422	done
423