Makefile revision 150850
1285809Sscottl#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2285809Sscottl# $FreeBSD: head/include/Makefile 150850 2005-10-03 07:09:41Z scottl $
3285809Sscottl#
4285809Sscottl# Doing a "make install" builds /usr/include.
5285809Sscottl
6285809SscottlCLEANFILES= osreldate.h version vers.c
7285809SscottlSUBDIR= arpa protocols rpcsvc rpc
8285809SscottlINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
9285809Sscottl	db.h \
10285809Sscottl	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
11285809Sscottl	fts.h ftw.h getopt.h glob.h grp.h \
12285809Sscottl	histedit.h ieeefp.h ifaddrs.h \
13285809Sscottl	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
14285809Sscottl	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
15285809Sscottl	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
16285809Sscottl	proc_service.h pthread.h \
17285809Sscottl	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
18285809Sscottl	resolv.h runetype.h search.h setjmp.h sgtty.h \
19285809Sscottl	signal.h stab.h \
20285809Sscottl	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
21285809Sscottl	strings.h sysexits.h tar.h tgmath.h \
22285809Sscottl	time.h timeconv.h timers.h ttyent.h \
23285809Sscottl	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
24285809Sscottl	wctype.h wordexp.h
25285809Sscottl
26285809SscottlMHDRS=	float.h floatingpoint.h stdarg.h
27285809Sscottl
28285809Sscottl# posix4/mqueue.h is useless without an implementation and isn't installed:
29285809SscottlPHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
30285809Sscottl
31285809SscottlLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
32285809Sscottl	termios.h ucontext.h
33285809Sscottl
34285809SscottlLDIRS=	bsm cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
35285809Sscottl	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
36285809Sscottl	pccard posix4 sys vm
37285809Sscottl
38285809SscottlLSUBDIRS=	cam/scsi \
39285809Sscottl	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
40285809Sscottl	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
41285809Sscottl	dev/pbio dev/ppbus dev/smbus dev/usb dev/wi dev/utopia \
42285809Sscottl	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
43285809Sscottl	fs/nwfs fs/portalfs fs/procfs fs/smbfs fs/udf fs/umapfs \
44285809Sscottl	fs/unionfs \
45285809Sscottl	geom/concat geom/eli geom/gate geom/label geom/mirror geom/nop \
46285809Sscottl	geom/raid3 geom/shsec geom/stripe \
47285809Sscottl	isofs/cd9660 \
48285809Sscottl	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
49285809Sscottl	netgraph/atm netgraph/netflow \
50285809Sscottl	security/mac_biba security/mac_bsdextended security/mac_lomac \
51285809Sscottl	security/mac_mls security/mac_partition \
52285809Sscottl	ufs/ffs ufs/ufs
53285809Sscottl
54285809Sscottl.if !defined(NO_GPIB)
55285809Sscottl_dev_ieee488=	dev/ieee488
56285809Sscottl.endif
57285809Sscottl
58285809Sscottl.if defined(YES_HESIOD)
59285809SscottlINCS+=	hesiod.h
60285809Sscottl.endif
61285809Sscottl
62285809Sscottl.if !defined(NO_BLUETOOTH)
63285809SscottlLSUBSUBDIRS=	netgraph/bluetooth/include
64285809Sscottl.endif
65285809Sscottl
66285809Sscottl# Define SHARED to indicate whether you want symbolic links to the system
67# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
68# probably only useful for developers and should be avoided if you do not
69# wish to tie your /usr/include and /usr/src together.
70#SHARED=	symlinks
71SHARED?=	copies
72
73INCS+=	osreldate.h
74
75osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
76		${.CURDIR}/../sys/sys/param.h \
77		${.CURDIR}/Makefile
78	@${ECHO} creating osreldate.h from newvers.sh
79	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
80	MAKE=${MAKE} . ${.CURDIR}/../sys/conf/newvers.sh;	\
81	echo "$$COPYRIGHT" > osreldate.h;			\
82	echo "#ifdef _KERNEL" >> osreldate.h;			\
83	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
84	echo "#else" >> osreldate.h;				\
85	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
86	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
87	echo "#endif" >> osreldate.h
88
89.for i in ${LHDRS}
90INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
91.endfor
92.for i in ${MHDRS}
93INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
94.endfor
95.for i in ${PHDRS}
96INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
97.endfor
98
99.if ${MACHINE} != ${MACHINE_ARCH}
100_MARCH=${MACHINE_ARCH}
101.endif
102
103.include <bsd.prog.mk>
104
105installincludes: ${SHARED}
106${SHARED}: compat
107
108# Take care of stale directory-level symlinks.
109compat:
110.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
111	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
112		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
113	fi
114.endfor
115	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
116	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
117	    -p ${DESTDIR}${INCLUDEDIR}
118.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
119	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
120	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
121	    -p ${DESTDIR}${INCLUDEDIR}
122.endif
123
124copies:
125.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
126	${_MARCH}
127.if exists(${DESTDIR}${INCLUDEDIR}/$i)
128	cd ${DESTDIR}${INCLUDEDIR}/$i; \
129	for h in *.h; do \
130		if [ -L $$h ]; then rm -f $$h; fi; \
131	done
132.endif
133.endfor
134.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
135	cd ${.CURDIR}/../sys; \
136	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
137	    ${DESTDIR}${INCLUDEDIR}/$i
138.endfor
139	cd ${.CURDIR}/../sys/dev/acpica; \
140	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
141	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
142	cd ${.CURDIR}/../sys/dev/bktr; \
143	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
144	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
145	cd ${.CURDIR}/../sys/contrib/altq/altq; \
146	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
147	    ${DESTDIR}${INCLUDEDIR}/altq
148.if !defined(NO_IPFILTER)
149	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
150	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
151	    ${DESTDIR}${INCLUDEDIR}/netinet
152.endif
153	cd ${.CURDIR}/../sys/contrib/pf/net; \
154	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
155	    ${DESTDIR}${INCLUDEDIR}/net
156	cd ${.CURDIR}/../sys/crypto; \
157	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
158	    ${DESTDIR}${INCLUDEDIR}/crypto
159	cd ${.CURDIR}/../sys/opencrypto; \
160	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
161	    ${DESTDIR}${INCLUDEDIR}/crypto
162	cd ${.CURDIR}/../sys/${MACHINE}/include; \
163	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
164	    ${DESTDIR}${INCLUDEDIR}/machine
165.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
166	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
167	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
168	    ${DESTDIR}${INCLUDEDIR}/machine/pc
169.endif
170.if defined(_MARCH)
171	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
172	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
173	cd ${.CURDIR}/../sys/${_MARCH}/include; \
174	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
175	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
176.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
177	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
178	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
179	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
180	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
181	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
182.endif
183.endif
184
185symlinks:
186	@${ECHO} "Setting up symlinks to kernel source tree..."
187.for i in ${LDIRS}
188	cd ${.CURDIR}/../sys/$i; \
189	for h in *.h; do \
190		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
191	done
192.endfor
193.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
194	cd ${.CURDIR}/../sys/$i; \
195	for h in *.h; do \
196		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
197	done
198.endfor
199	cd ${.CURDIR}/../sys/dev/acpica; \
200	for h in acpiio.h; do \
201		ln -fs ../../../../sys/dev/acpica/$$h \
202		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
203	done
204	cd ${.CURDIR}/../sys/dev/bktr; \
205	for h in ioctl_*.h; do \
206		ln -fs ../../../../sys/dev/bktr/$$h \
207		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
208	done
209.for i in ${LSUBSUBDIRS}
210	cd ${.CURDIR}/../sys/$i; \
211	for h in *.h; do \
212		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
213	done
214.endfor
215	cd ${.CURDIR}/../sys/contrib/altq/altq; \
216	for h in *.h; do \
217		ln -fs ../../../sys/contrib/altq/altq/$$h \
218		    ${DESTDIR}${INCLUDEDIR}/altq; \
219	done
220.if !defined(NO_IPFILTER)
221	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
222	for h in *.h; do \
223		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
224		    ${DESTDIR}${INCLUDEDIR}/netinet; \
225	done
226.endif
227	cd ${.CURDIR}/../sys/contrib/pf/net; \
228	for h in *.h; do \
229		ln -fs ../../../sys/contrib/pf/net/$$h \
230		    ${DESTDIR}${INCLUDEDIR}/net; \
231	done
232	cd ${.CURDIR}/../sys/crypto; \
233	for h in rijndael/rijndael.h; do \
234		ln -fs ../../../sys/crypto/$$h \
235		    ${DESTDIR}${INCLUDEDIR}/crypto; \
236	done
237	cd ${.CURDIR}/../sys/opencrypto; \
238	for h in *.h; do \
239		ln -fs ../../../sys/opencrypto/$$h \
240		    ${DESTDIR}${INCLUDEDIR}/crypto; \
241	done
242	cd ${.CURDIR}/../sys/${MACHINE}/include; \
243	for h in *.h; do \
244		ln -fs ../../../sys/${MACHINE}/include/$$h \
245		    ${DESTDIR}${INCLUDEDIR}/machine; \
246	done
247.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
248	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
249	for h in *.h; do \
250		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
251		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
252	done
253.endif
254.if defined(_MARCH)
255	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
256	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
257	cd ${.CURDIR}/../sys/${_MARCH}/include; \
258	for h in *.h; do \
259		ln -fs ../../../sys/${_MARCH}/include/$$h \
260		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
261	done
262.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
263	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
264	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
265	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
266	for h in *.h; do \
267		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
268		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
269	done
270.endif
271.endif
272