Makefile.inc revision 1.75
1#	$OpenBSD: Makefile.inc,v 1.75 2005/11/29 21:29:15 deraadt 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_rfork.c Lint_sbrk.c \
15	Lint_sigpending.c Lint_sigprocmask.c Lint_sigreturn.c \
16	Lint_sigsuspend.c Lint_syscall.c Lint_crt.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 Lint_crt.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 closefrom.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 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
62GASM=	${ASM:.o=.go}
63PASM=	${ASM:.o=.po}
64SASM=	${ASM:.o=.so}
65
66PSEUDO=	_getlogin.o _setlogin.o _ptrace.o
67GPSEUDO=${PSEUDO:.o=.go}
68PPSEUDO=${PSEUDO:.o=.po}
69SPSEUDO=${PSEUDO:.o=.so}
70
71PSEUDO_NOERR=	_exit.o
72GPSEUDO_NOERR=${PSEUDO_NOERR:.o=.go}
73PPSEUDO_NOERR=${PSEUDO_NOERR:.o=.po}
74SPSEUDO_NOERR=${PSEUDO_NOERR:.o=.so}
75
76OBJS+=	${ASM} ${PSEUDO} ${PSEUDO_NOERR}
77
78${GASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
79	@echo creating ${.TARGET}
80	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
81	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
82	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
83	@rm -f ${.TARGET}.o
84
85${PASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
86	@echo creating ${.TARGET}
87	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
88	    ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
89	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
90	@rm -f ${.TARGET}.o
91
92.if (${MACHINE_ARCH} != "mips")
93${SASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
94	@echo creating ${.TARGET}
95	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
96	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | \
97	    ${AS} ${ASPICFLAG} -o ${.TARGET}
98.else
99${SASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
100	@echo creating ${.TARGET}
101	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
102	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}
103.endif
104
105${ASM}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
106	@echo creating ${.TARGET}
107	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
108	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
109	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
110	@rm -f ${.TARGET}.o
111
112${GPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
113	@echo creating ${.TARGET}
114	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
115	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
116	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
117	@rm -f ${.TARGET}.o
118
119${PPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
120	@echo creating ${.TARGET}
121	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
122	    ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
123	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
124	@rm -f ${.TARGET}.o
125
126.if (${MACHINE_ARCH} != "mips")
127${SPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
128	@echo creating ${.TARGET}
129	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
130	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | \
131	    ${AS} ${ASPICFLAG} -o ${.TARGET}
132.else
133${SPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
134	@echo creating ${.TARGET}
135	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
136	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}
137.endif
138
139${PSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
140	@echo creating ${.TARGET}
141	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
142	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
143	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
144	@rm -f ${.TARGET}.o
145
146${GPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
147	@echo creating ${.TARGET}
148	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
149	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
150	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
151	@rm -f ${.TARGET}.o
152
153${PPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
154	@echo creating ${.TARGET}
155	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
156	    ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
157	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
158	@rm -f ${.TARGET}.o
159
160.if (${MACHINE_ARCH} != "mips")
161${SPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
162	@echo creating ${.TARGET}
163	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
164	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | \
165	    ${AS} ${ASPICFLAG} -o ${.TARGET}
166.else
167${SPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
168	@echo creating ${.TARGET}
169	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
170	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}
171.endif
172
173${PSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
174	@echo creating ${.TARGET}
175	@printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
176	    ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o
177	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
178	@rm -f ${.TARGET}.o
179
180# Lint stubs for all automatically-generated assembly stubs (GENERATED)
181#LSRCS+=	LintSysNormal.c LintSysNoerr.c LintSysPseudoNoerr.c
182#DPSRCS+= LintSysNormal.c LintSysNoerr.c LintSysPseudoNoerr.c
183LSRCS+=	LintSysNormal.c LintSysPseudoNoerr.c
184DPSRCS+= LintSysNormal.c LintSysPseudoNoerr.c
185
186CLEANFILES+= LintSysNormal.c LintSysNoerr.c LintSysPseudo.c
187
188LintSysNormal.c: ${LIBCSRCDIR}/sys/makelintstub.sh \
189    ${DESTDIR}/usr/include/sys/syscall.h
190	@echo creating ${.TARGET}
191	@sh ${LIBCSRCDIR}/sys/makelintstub.sh -o ${.TARGET} \
192	    -s ${DESTDIR}/usr/include/sys/syscall.h ${ASM}
193
194LintSysNoerr.c: ${LIBCSRCDIR}/sys/makelintstub.sh \
195    ${DESTDIR}/usr/include/sys/syscall.h
196	@echo creating ${.TARGET}
197	@sh ${LIBCSRCDIR}/sys/makelintstub.sh -o ${.TARGET} -n \
198	    -s ${DESTDIR}/usr/include/sys/syscall.h ${NOERR}
199
200LintSysPseudoNoerr.c: ${LIBCSRCDIR}/sys/makelintstub.sh \
201    ${DESTDIR}/usr/include/sys/syscall.h
202	@echo creating ${.TARGET}
203	@sh ${LIBCSRCDIR}/sys/makelintstub.sh -o ${.TARGET} -p \
204	    -s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDO_NOERR}
205
206MAN+=	accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chflags.2 \
207	chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 closefrom.2 connect.2 \
208	dup.2 execve.2 _exit.2 fcntl.2 fhopen.2 \
209	flock.2 fork.2 fsync.2 getdirentries.2 \
210	getfh.2 getfsstat.2 getgid.2 getgroups.2 getitimer.2 getlogin.2 \
211	getpeername.2 getpeereid.2 getpgrp.2 \
212	getpid.2 getpriority.2 getrlimit.2 getrusage.2 getsid.2 getsockname.2 \
213	getsockopt.2 gettimeofday.2 getuid.2 intro.2 issetugid.2 ioctl.2 \
214	kill.2 kqueue.2 ktrace.2 link.2 \
215	listen.2 lseek.2 mkdir.2 mkfifo.2 mknod.2 madvise.2 \
216	mquery.2 mincore.2 minherit.2 mlock.2 mlockall.2 \
217	mmap.2 mount.2 mprotect.2 msync.2 munmap.2 nanosleep.2 \
218	nfssvc.2 open.2 pathconf.2 \
219	pipe.2 profil.2 poll.2 ptrace.2 quotactl.2 read.2 readlink.2 reboot.2 \
220	recv.2 rename.2 revoke.2 rfork.2 rmdir.2 select.2 send.2 setgroups.2 \
221	setpgid.2 setregid.2 setreuid.2 setresuid.2 setsid.2 setuid.2 \
222	shutdown.2 sigaction.2 sigaltstack.2 sigpending.2 sigprocmask.2 \
223	sigreturn.2 sigstack.2 sigsuspend.2 socket.2 socketpair.2 stat.2 \
224	statfs.2 swapctl.2 symlink.2 sync.2 sysarch.2 syscall.2 truncate.2 \
225	umask.2 unlink.2 utimes.2 vfork.2 wait.2 write.2
226
227MAN+=	msgctl.2 shmctl.2 shmat.2 semop.2 semget.2 semctl.2 msgsnd.2 msgrcv.2 \
228	msgget.2 shmget.2
229
230MLINKS+=brk.2 sbrk.2
231MLINKS+=dup.2 dup2.2
232MLINKS+=chdir.2 fchdir.2
233MLINKS+=chflags.2 fchflags.2
234MLINKS+=chmod.2 fchmod.2
235MLINKS+=chown.2 fchown.2
236MLINKS+=chown.2 lchown.2
237MLINKS+=clock_gettime.2 clock_settime.2
238MLINKS+=clock_gettime.2 clock_getres.2
239MLINKS+=execve.2 exect.2
240MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2
241MLINKS+=getgid.2 getegid.2
242MLINKS+=getitimer.2 setitimer.2
243MLINKS+=getitimer.2 timeradd.3
244MLINKS+=getitimer.2 timerclear.3
245MLINKS+=getitimer.2 timercmp.3
246MLINKS+=getitimer.2 timerisset.3
247MLINKS+=getitimer.2 timersub.3
248MLINKS+=getlogin.2 getlogin_r.2 getlogin.2 setlogin.2
249MLINKS+=getpgrp.2 getpgid.2
250MLINKS+=getpid.2 getppid.2
251MLINKS+=getpriority.2 setpriority.2
252MLINKS+=getrlimit.2 setrlimit.2
253MLINKS+=getsockopt.2 setsockopt.2
254MLINKS+=gettimeofday.2 settimeofday.2
255MLINKS+=getuid.2 geteuid.2
256MLINKS+=kqueue.2 kevent.2
257MLINKS+=intro.2 errno.2
258MLINKS+=mlock.2 munlock.2
259MLINKS+=mlockall.2 munlockall.2
260MLINKS+=mount.2 unmount.2
261MLINKS+=pathconf.2 fpathconf.2
262MLINKS+=read.2 readv.2 read.2 pread.2 read.2 preadv.2
263MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2
264MLINKS+=send.2 sendmsg.2 send.2 sendto.2
265MLINKS+=setpgid.2 setpgrp.2
266MLINKS+=setuid.2 setegid.2 setuid.2 seteuid.2 setuid.2 setgid.2
267MLINKS+=setresuid.2 getresgid.2 setresuid.2 getresuid.2
268MLINKS+=setresuid.2 setresgid.2
269MLINKS+=shmat.2 shmdt.2
270MLINKS+=stat.2 fstat.2 stat.2 lstat.2
271MLINKS+=statfs.2 fstatfs.2
272MLINKS+=syscall.2 __syscall.2
273MLINKS+=truncate.2 ftruncate.2
274MLINKS+=utimes.2 futimes.2
275MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2
276MLINKS+=write.2 writev.2 write.2 pwrite.2 write.2 pwritev.2
277MLINKS+=select.2 FD_SET.3 select.2 FD_CLR.3
278MLINKS+=select.2 FD_ISSET.3 select.2 FD_ZERO.3
279MLINKS+=wait.2 WIFCONTINUED.2 wait.2 WIFEXITED.2
280MLINKS+=wait.2 WIFSIGNALED.2 wait.2 WIFSTOPPED.2 wait.2 WTERMSIG.2
281MLINKS+=wait.2 WEXITSTATUS.2 wait.2 WCOREDUMP.2 wait.2 WSTOPSIG.2
282