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