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