Makefile.inc revision 1.66
1#	$OpenBSD: Makefile.inc,v 1.66 2003/05/10 17:52:17 miod Exp $
2#	$NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $
3#	@(#)Makefile.inc	8.1 (Berkeley) 6/17/93
4
5# sys sources
6.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/sys ${LIBCSRCDIR}/sys
7
8# modules with non-default implementations on at least one architecture:
9SRCS+=	Ovfork.S brk.S cerror.S exect.S fork.S rfork.S \
10	sbrk.S sigpending.S sigprocmask.S sigreturn.S \
11	sigsuspend.S syscall.S
12
13LSRCS+=	Lint_Ovfork.c Lint_brk.c Lint_exect.c Lint_fork.c \
14	Lint_sbrk.c \
15	Lint_sigpending.c Lint_sigprocmask.c Lint_sigreturn.c \
16	Lint_sigsuspend.c Lint_syscall.c
17DPSRCS+= Lint_Ovfork.c Lint_brk.c Lint_exect.c Lint_fork.c \
18	Lint_sbrk.c \
19	Lint_sigpending.c Lint_sigprocmask.c Lint_sigreturn.c \
20	Lint_sigsuspend.c Lint_syscall.c
21
22# glue to provide compatibility between GCC 1.X and 2.X and for compat
23# with old syscall interfaces.
24SRCS+=	ftruncate.c lseek.c mquery.c mmap.c ptrace.c semctl.c truncate.c \
25	timer_create.c timer_delete.c timer_getoverrun.c timer_gettime.c \
26	timer_settime.c pread.c preadv.c pwrite.c pwritev.c
27
28# stack protector helper functions
29SRCS+=	stack_protector.c
30
31# modules with default implementations on all architectures:
32ASM=	accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \
33	chown.o chroot.o clock_gettime.o clock_settime.o clock_getres.o \
34	close.o connect.o dup.o dup2.o execve.o fchdir.o \
35	fchflags.o fchmod.o fchown.o fcntl.o fhopen.o fhstat.o fhstatfs.o \
36	flock.o fpathconf.o fstat.o \
37	fstatfs.o fsync.o futimes.o getdirentries.o getegid.o geteuid.o \
38	getfh.o getfsstat.o getgid.o getgroups.o getitimer.o getpeereid.o \
39	getpeername.o \
40	getpgid.o \
41	getpgrp.o getpid.o getppid.o getpriority.o getresgid.o getresuid.o \
42	getrlimit.o getrusage.o getsid.o \
43	getsockname.o getsockopt.o gettimeofday.o getuid.o issetugid.o \
44	ioctl.o kill.o kevent.o kqueue.o \
45	ktrace.o lchown.o lfs_bmapv.o lfs_markv.o lfs_segclean.o lfs_segwait.o \
46	link.o listen.o lstat.o madvise.o mincore.o minherit.o mkdir.o \
47	mkfifo.o mknod.o mlock.o mlockall.o \
48	mount.o mprotect.o msgctl.o msgget.o msgrcv.o msgsnd.o msync.o \
49	munlock.o munlockall.o munmap.o nanosleep.o nfssvc.o \
50	open.o pathconf.o pipe.o poll.o profil.o quotactl.o \
51	read.o readlink.o readv.o reboot.o recvfrom.o recvmsg.o rename.o \
52	revoke.o rmdir.o select.o semget.o semop.o sendmsg.o sendto.o \
53	setegid.o seteuid.o setgid.o setgroups.o setitimer.o setpgid.o \
54	setpriority.o setregid.o setreuid.o setresgid.o setresuid.o \
55	setrlimit.o setsid.o setsockopt.o settimeofday.o \
56	setuid.o shmat.o shmctl.o shmdt.o shmget.o shutdown.o sigaction.o \
57	sigaltstack.o socket.o socketpair.o stat.o statfs.o swapctl.o \
58	symlink.o sync.o sysarch.o umask.o undelete.o unlink.o unmount.o \
59	utimes.o vadvise.o wait4.o write.o writev.o xfspioctl.o __semctl.o \
60	__syscall.o __sysctl.o
61
62ASM+=	extattrctl.o extattr_set_file.o extattr_get_file.o \
63	extattr_delete_file.o extattr_set_fd.o extattr_get_fd.o \
64	extattr_delete_fd.o
65
66GASM=	${ASM:.o=.go}
67PASM=	${ASM:.o=.po}
68SASM=	${ASM:.o=.so}
69
70PSEUDO=	_getlogin.o _setlogin.o _ptrace.o
71GPSEUDO=${PSEUDO:.o=.go}
72PPSEUDO=${PSEUDO:.o=.po}
73SPSEUDO=${PSEUDO:.o=.so}
74
75PSEUDO_NOERR=	_exit.o
76GPSEUDO_NOERR=${PSEUDO_NOERR:.o=.go}
77PPSEUDO_NOERR=${PSEUDO_NOERR:.o=.po}
78SPSEUDO_NOERR=${PSEUDO_NOERR:.o=.so}
79
80OBJS+=	${ASM} ${PSEUDO} ${PSEUDO_NOERR}
81
82${GASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
83	@echo creating ${.TARGET}
84	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
85	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
86	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
87	@rm -f ${.TARGET}.o
88
89${PASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
90	@echo creating ${.TARGET}
91	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
92	    ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
93	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
94	@rm -f ${.TARGET}.o
95
96.if (${MACHINE_ARCH} != "mips")
97${SASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
98	@echo creating ${.TARGET}
99	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
100	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | \
101	    ${AS} ${ASPICFLAG} -o ${.TARGET}
102.else
103${SASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
104	@echo creating ${.TARGET}
105	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
106	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}
107.endif
108
109${ASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
110	@echo creating ${.TARGET}
111	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
112	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
113	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
114	@rm -f ${.TARGET}.o
115
116${GPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
117	@echo creating ${.TARGET}
118	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
119	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
120	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
121	@rm -f ${.TARGET}.o
122
123${PPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
124	@echo creating ${.TARGET}
125	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
126	    ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
127	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
128	@rm -f ${.TARGET}.o
129
130.if (${MACHINE_ARCH} != "mips")
131${SPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
132	@echo creating ${.TARGET}
133	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
134	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | \
135	    ${AS} ${ASPICFLAG} -o ${.TARGET}
136.else
137${SPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
138	@echo creating ${.TARGET}
139	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
140	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}
141.endif
142
143${PSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
144	@echo creating ${.TARGET}
145	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
146	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
147	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
148	@rm -f ${.TARGET}.o
149
150${GPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
151	@echo creating ${.TARGET}
152	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
153	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
154	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
155	@rm -f ${.TARGET}.o
156
157${PPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
158	@echo creating ${.TARGET}
159	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
160	    ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
161	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
162	@rm -f ${.TARGET}.o
163
164.if (${MACHINE_ARCH} != "mips")
165${SPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
166	@echo creating ${.TARGET}
167	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
168	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | \
169	    ${AS} ${ASPICFLAG} -o ${.TARGET}
170.else
171${SPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
172	@echo creating ${.TARGET}
173	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
174	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}
175.endif
176
177${PSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
178	@echo creating ${.TARGET}
179	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
180	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
181	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
182	@rm -f ${.TARGET}.o
183
184# Lint stubs for all automatically-generated assembly stubs (GENERATED)
185#LSRCS+=	LintSysNormal.c LintSysNoerr.c LintSysPseudoNoerr.c
186#DPSRCS+= LintSysNormal.c LintSysNoerr.c LintSysPseudoNoerr.c
187LSRCS+=	LintSysNormal.c
188DPSRCS+= LintSysNormal.c
189
190CLEANFILES+= LintSysNormal.c LintSysNoerr.c LintSysPseudo.c
191
192LintSysNormal.c: ${LIBCSRCDIR}/sys/makelintstub.sh \
193    ${DESTDIR}/usr/include/sys/syscall.h
194	@echo creating ${.TARGET}
195	@sh ${LIBCSRCDIR}/sys/makelintstub.sh -o ${.TARGET} \
196	    -s ${DESTDIR}/usr/include/sys/syscall.h ${ASM}
197
198LintSysNoerr.c: ${LIBCSRCDIR}/sys/makelintstub.sh \
199    ${DESTDIR}/usr/include/sys/syscall.h
200	@echo creating ${.TARGET}
201	@sh ${LIBCSRCDIR}/sys/makelintstub.sh -o ${.TARGET} -n \
202	    -s ${DESTDIR}/usr/include/sys/syscall.h ${NOERR}
203
204LintSysPseudoNoerr.c: ${LIBCSRCDIR}/sys/makelintstub.sh \
205    ${DESTDIR}/usr/include/sys/syscall.h
206	@echo creating ${.TARGET}
207	@sh ${LIBCSRCDIR}/sys/makelintstub.sh -o ${.TARGET} -p \
208	    -s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDONOERR}
209
210MAN+=	accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chflags.2 \
211	chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 connect.2 dup.2 \
212	execve.2 _exit.2 fcntl.2 fhopen.2 \
213	flock.2 fork.2 fsync.2 getdirentries.2 \
214	getfh.2 getfsstat.2 getgid.2 getgroups.2 getitimer.2 getlogin.2 \
215	getpeername.2 getpeereid.2 getpgrp.2 \
216	getpid.2 getpriority.2 getrlimit.2 getrusage.2 getsid.2 getsockname.2 \
217	getsockopt.2 gettimeofday.2 getuid.2 intro.2 issetugid.2 ioctl.2 \
218	kill.2 kqueue.2 ktrace.2 link.2 \
219	listen.2 lseek.2 mkdir.2 mkfifo.2 mknod.2 madvise.2 \
220	mquery.2 mincore.2 minherit.2 mlock.2 mlockall.2 \
221	mmap.2 mount.2 mprotect.2 msync.2 munmap.2 nanosleep.2 \
222	nfssvc.2 open.2 pathconf.2 \
223	pipe.2 profil.2 poll.2 ptrace.2 quotactl.2 read.2 readlink.2 reboot.2 \
224	recv.2 rename.2 revoke.2 rfork.2 rmdir.2 select.2 send.2 setgroups.2 \
225	setpgid.2 setregid.2 setreuid.2 setresuid.2 setsid.2 setuid.2 \
226	shutdown.2 sigaction.2 sigaltstack.2 sigpending.2 sigprocmask.2 \
227	sigreturn.2 sigstack.2 sigsuspend.2 socket.2 socketpair.2 stat.2 \
228	statfs.2 swapctl.2 symlink.2 sync.2 sysarch.2 syscall.2 truncate.2 \
229	umask.2 unlink.2 utimes.2 vfork.2 wait.2 write.2
230
231MAN+=	extattr_get_file.2
232MLINKS+=extattr_get_file.2 extattr_set_file.2 \
233	extattr_get_file.2 extattr_delete_file.2 \
234	extattr_get_file.2 extattr_get_fd.2 \
235	extattr_get_file.2 extattr_set_fd.2 \
236	extattr_get_file.2 extattr_delete_fd.2 \
237	extattr_get_file.2 extattr.2
238
239MAN+=	msgctl.2 shmctl.2 shmat.2 semop.2 semget.2 semctl.2 msgsnd.2 msgrcv.2 \
240	msgget.2 shmget.2
241
242MLINKS+=brk.2 sbrk.2
243MLINKS+=dup.2 dup2.2
244MLINKS+=chdir.2 fchdir.2
245MLINKS+=chflags.2 fchflags.2
246MLINKS+=chmod.2 fchmod.2
247MLINKS+=chown.2 fchown.2
248MLINKS+=chown.2 lchown.2
249MLINKS+=clock_gettime.2 clock_settime.2
250MLINKS+=clock_gettime.2 clock_getres.2
251MLINKS+=execve.2 exect.2
252MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2
253MLINKS+=getgid.2 getegid.2
254MLINKS+=getitimer.2 setitimer.2
255MLINKS+=getitimer.2 timeradd.3
256MLINKS+=getitimer.2 timerclear.3
257MLINKS+=getitimer.2 timercmp.3
258MLINKS+=getitimer.2 timerisset.3
259MLINKS+=getitimer.2 timersub.3
260MLINKS+=getlogin.2 getlogin_r.2 getlogin.2 setlogin.2
261MLINKS+=getpgrp.2 getpgid.2
262MLINKS+=getpid.2 getppid.2
263MLINKS+=getpriority.2 setpriority.2
264MLINKS+=getrlimit.2 setrlimit.2
265MLINKS+=getsockopt.2 setsockopt.2
266MLINKS+=gettimeofday.2 settimeofday.2
267MLINKS+=getuid.2 geteuid.2
268MLINKS+=kqueue.2 kevent.2
269MLINKS+=intro.2 errno.2
270MLINKS+=mlock.2 munlock.2
271MLINKS+=mlockall.2 munlockall.2
272MLINKS+=mount.2 unmount.2
273MLINKS+=pathconf.2 fpathconf.2
274MLINKS+=read.2 readv.2 read.2 pread.2 read.2 preadv.2
275MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2
276MLINKS+=send.2 sendmsg.2 send.2 sendto.2
277MLINKS+=setpgid.2 setpgrp.2
278MLINKS+=setuid.2 setegid.2 setuid.2 seteuid.2 setuid.2 setgid.2
279MLINKS+=setresuid.2 getresgid.2 setresuid.2 getresuid.2
280MLINKS+=setresuid.2 setresgid.2
281MLINKS+=shmat.2 shmdt.2
282MLINKS+=stat.2 fstat.2 stat.2 lstat.2
283MLINKS+=statfs.2 fstatfs.2
284MLINKS+=syscall.2 __syscall.2
285MLINKS+=truncate.2 ftruncate.2
286MLINKS+=utimes.2 futimes.2
287MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2
288MLINKS+=write.2 writev.2 write.2 pwrite.2 write.2 pwritev.2
289MLINKS+=select.2 FD_SET.3 select.2 FD_CLR.3
290MLINKS+=select.2 FD_ISSET.3 select.2 FD_ZERO.3
291