Makefile revision 137556
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 137556 2004-11-10 22:21:07Z markm $
31539Srgrimes#
4114731Sbde# Doing a "make install" builds /usr/include.
51539Srgrimes
618420SbdeCLEANFILES= osreldate.h version vers.c
796462SruSUBDIR= arpa protocols rpcsvc rpc
8133567StjrINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
9133559Stjr	db.h \
10107046Smarcel	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
11131661Sdas	fts.h ftw.h getopt.h glob.h grp.h \
12131661Sdas	hesiod.h histedit.h ieeefp.h ifaddrs.h \
13107046Smarcel	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
14107046Smarcel	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
15113595Snectar	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
16132173Sdavidxu	proc_service.h pthread.h \
17107046Smarcel	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
18136609Stjr	resolv.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
19121640Speter	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
20133333Sstefanf	strings.h sysexits.h tar.h tgmath.h \
21133333Sstefanf	time.h timeconv.h timers.h ttyent.h \
22119630Skan	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
23119630Skan	wctype.h wordexp.h
241539Srgrimes
25119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
2634030Sdufault
27104219Smike# posix4/mqueue.h is useless without an implementation and isn't installed:
28104634SmikePHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
2934030Sdufault
3088055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
3164767Sjhb	termios.h ucontext.h
321539Srgrimes
33116948SsamLDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
34116948Ssam	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
3583653Speter	pccard posix4 sys vm
3617900Speter
37123288SobrienLSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
38123288Sobrien	dev/ofw dev/ppbus dev/smbus dev/usb dev/wi dev/utopia fs/devfs \
3977223Sru	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
40128769Spjd	fs/procfs fs/smbfs fs/udf fs/umapfs fs/unionfs \
41133812Spjd	geom/concat geom/gate geom/label geom/mirror geom/nop geom/raid3 \
42133812Spjd	geom/stripe \
43128769Spjd	isofs/cd9660 netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
44135339Sglebius	netgraph/atm netgraph/netflow \
45135339Sglebius	security/mac_biba security/mac_bsdextended security/mac_lomac \
46135339Sglebius	security/mac_mls security/mac_partition \
47137556Smarkm	ufs/ffs ufs/ufs
4877031Sru
49125123Semax.if !defined(NO_BLUETOOTH)
50114731SbdeLSUBSUBDIRS=	netgraph/bluetooth/include
51125123Semax.endif
52107139Sjulian
5354351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
5454351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
5554351Smarcel# probably only useful for developers and should be avoided if you do not
5654351Smarcel# wish to tie your /usr/include and /usr/src together.
5754351Smarcel#SHARED=	symlinks
5854351SmarcelSHARED?=	copies
5954351Smarcel
6096462SruINCS+=	osreldate.h
6125734Speter
6236283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
6378376Speter		${.CURDIR}/../sys/sys/param.h \
6478376Speter		${.CURDIR}/Makefile
6525734Speter	@${ECHO} creating osreldate.h from newvers.sh
66117236Sru	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
67135371Sru	MAKE=${MAKE} . ${.CURDIR}/../sys/conf/newvers.sh;	\
6825734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
6972673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
70114731Sbde	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
7172673Speter	echo "#else" >> osreldate.h;				\
7225734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
7372673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
7472673Speter	echo "#endif" >> osreldate.h
7525734Speter
7688055Sru.for i in ${LHDRS}
7796462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
7817900Speter.endfor
7988055Sru.for i in ${MHDRS}
8096462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
8117900Speter.endfor
8288055Sru.for i in ${PHDRS}
8396462SruINCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
8434030Sdufault.endfor
8554351Smarcel
86114731Sbde.include <bsd.prog.mk>
87114731Sbde
88114731Sbdeinstallincludes: ${SHARED}
89114731Sbde${SHARED}: compat
90114731Sbde
91114731Sbde# Take care of stale directory-level symlinks.
92114731Sbdecompat:
93114731Sbde.for i in ${LDIRS} ${LSUBDIRS} machine crypto
94114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
95114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
9654351Smarcel	fi
9754351Smarcel.endfor
98114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
99114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
100114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
101135851Sdougb.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
102135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
103135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
104135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
105135851Sdougb.endif
106114731Sbde
107114731Sbdecopies:
108114731Sbde.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
109114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
110114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
111114731Sbde	for h in *.h; do \
112114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
113114731Sbde	done
114114731Sbde.endif
115114731Sbde.endfor
116123288Sobrien.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
11754351Smarcel	cd ${.CURDIR}/../sys; \
118114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
119114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
12054351Smarcel.endfor
121123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
122123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
123123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
124130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
125130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
126130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
127116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
128116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
129116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
130126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
131126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
132126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
133116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
134116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
135114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
13677857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
137114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
138114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
13993229Sru.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
14093229Sru	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
141114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
142114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
14377857Sjlemon.endif
1441539Srgrimes
14554351Smarcelsymlinks:
14654351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
14756645Speter.for i in ${LDIRS}
148114731Sbde	cd ${.CURDIR}/../sys/$i; \
149114731Sbde	for h in *.h; do \
150114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
151114731Sbde	done
15254351Smarcel.endfor
153114731Sbde.for i in ${LSUBDIRS}
154114731Sbde	cd ${.CURDIR}/../sys/$i; \
155114731Sbde	for h in *.h; do \
156114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
157114731Sbde	done
15877046Sru.endfor
159114731Sbde.for i in ${LSUBSUBDIRS}
160114731Sbde	cd ${.CURDIR}/../sys/$i; \
161114731Sbde	for h in *.h; do \
162114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
163114731Sbde	done
164114731Sbde.endfor
165130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
166130416Smlaier	for h in *.h; do \
167130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
168130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
169130416Smlaier	done
170116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
171116734Sru	for h in *.h; do \
172116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
173116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
174116734Sru	done
175126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
176126385Smlaier	for h in *.h; do \
177126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
178126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
179126385Smlaier	done
180114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
181114731Sbde	for h in *.h; do \
182114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
183114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
184114731Sbde	done
185114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
186114731Sbde	for h in *.h; do \
187114731Sbde		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
188114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
189114731Sbde	done
190114731Sbde.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
191114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
192114731Sbde	for h in *.h; do \
193114731Sbde		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
194114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
195114731Sbde	done
196114731Sbde.endif
197