summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-09-09 09:16:40 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-09-09 09:16:40 +0000
commit860d1bf002d266a56987b59800a1ed7c272e7737 (patch)
tree354479391b226d3a0ac4dd7c527d32702572a7f3 /lib
parent02b5a612ffd485b39d832c2989d534b1b1707063 (diff)
Simplify makefile rules for building the ASM stubs into "pick something
from column A and something from column B". ok miod@ deraadt@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/Makefile.inc158
1 files changed, 45 insertions, 113 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index d89fa346cf4..0b72e7fb80c 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.128 2015/08/26 01:54:09 guenther Exp $
+# $OpenBSD: Makefile.inc,v 1.129 2015/09/09 09:16:39 guenther Exp $
# $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $
# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
@@ -83,119 +83,51 @@ DPSEUDO_NOERR=${PSEUDO_NOERR:.o=.do}
OBJS+= ${ASM} ${PSEUDO} ${PSEUDO_NOERR}
-${GASM}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
- ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp - \
- -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
+SYS_DEP = ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
+
+# XXX only difference is -x removes FILE symbols?
+TRIM=${LD} -x -r ${.TARGET}.o -o ${.TARGET} && rm -f ${.TARGET}.o
+TRIM.debug=${LD} -X -r ${.TARGET}.o -o ${.TARGET} && rm -f ${.TARGET}.o
+
+
+# Pick one of these to set what ASM is generated...
+GENERATE.rsyscall=\
+ echo creating ${.TARGET} && \
+ printf '\#include "SYS.h"\nRSYSCALL(${.PREFIX})\n'
+GENERATE.pseudo=\
+ echo creating ${.TARGET} && \
+ printf '\#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n'
+GENERATE.pseudo_noerr=\
+ echo creating ${.TARGET} && \
+ printf '\#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n'
+
+# ...and one of these to control how it's compiled
+FINISH= ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp -
+FINISH.go=${FINISH} -o ${.TARGET}.o && ${TRIM.debug}
+FINISH.po=${FINISH} -o ${.TARGET}.o -DPROF && ${TRIM.debug}
+FINISH.so=${FINISH} -o ${.TARGET} ${PICFLAG}
+FINISH.do=${FINISH} -o ${.TARGET}.o ${DIST_CFLAGS} && ${TRIM}
+FINISH.o =${FINISH} -o ${.TARGET}.o && ${TRIM}
+
+# Use those to generate the desired syscall stubs
+${GASM}: ${SYS_DEP} ; @${GENERATE.rsyscall} | ${FINISH.go}
+${PASM}: ${SYS_DEP} ; @${GENERATE.rsyscall} | ${FINISH.po}
+${SASM}: ${SYS_DEP} ; @${GENERATE.rsyscall} | ${FINISH.so}
+${DASM}: ${SYS_DEP} ; @${GENERATE.rsyscall} | ${FINISH.do}
+${ASM}: ${SYS_DEP} ; @${GENERATE.rsyscall} | ${FINISH.o}
+
+${GPSEUDO}: ${SYS_DEP} ; @${GENERATE.pseudo} | ${FINISH.go}
+${PPSEUDO}: ${SYS_DEP} ; @${GENERATE.pseudo} | ${FINISH.po}
+${SPSEUDO}: ${SYS_DEP} ; @${GENERATE.pseudo} | ${FINISH.so}
+${DPSEUDO}: ${SYS_DEP} ; @${GENERATE.pseudo} | ${FINISH.do}
+${PSEUDO}: ${SYS_DEP} ; @${GENERATE.pseudo} | ${FINISH.o}
+
+${GPSEUDO_NOERR}: ${SYS_DEP} ; @${GENERATE.pseudo_noerr} | ${FINISH.go}
+${PPSEUDO_NOERR}: ${SYS_DEP} ; @${GENERATE.pseudo_noerr} | ${FINISH.po}
+${SPSEUDO_NOERR}: ${SYS_DEP} ; @${GENERATE.pseudo_noerr} | ${FINISH.so}
+${DPSEUDO_NOERR}: ${SYS_DEP} ; @${GENERATE.pseudo_noerr} | ${FINISH.do}
+${PSEUDO_NOERR}: ${SYS_DEP} ; @${GENERATE.pseudo_noerr} | ${FINISH.o}
-${PASM}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
- ${COMPILE.S} -DPROF ${CFLAGS:M-[ID]*} ${AINC} \
- -x assembler-with-cpp - -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${SASM}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
- ${COMPILE.S} ${PICFLAG} ${CFLAGS:M-[ID]*} ${AINC} \
- -x assembler-with-cpp - -o ${.TARGET}
-
-${DASM}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
- ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp - \
- ${DIST_CFLAGS} -o ${.TARGET}.o
- @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${ASM}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
- ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp - \
- -o ${.TARGET}.o
- @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${GPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp - \
- -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${PPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} -DPROF ${CFLAGS:M-[ID]*} ${AINC} \
- -x assembler-with-cpp - -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${SPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} ${PICFLAG} ${CFLAGS:M-[ID]*} ${AINC} \
- -x assembler-with-cpp - -o ${.TARGET}
-
-${DPSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp - \
- ${DIST_CFLAGS} -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${PSEUDO}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp - \
- -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${GPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp - \
- -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${PPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} -DPROF ${CFLAGS:M-[ID]*} ${AINC} \
- -x assembler-with-cpp - -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${SPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} ${PICFLAG} ${CFLAGS:M-[ID]*} ${AINC} \
- -x assembler-with-cpp - -o ${.TARGET}
-
-${DPSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp - \
- ${DIST_CFLAGS} -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
-
-${PSEUDO_NOERR}: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
- @echo creating ${.TARGET}
- @printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' | \
- ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp - \
- -o ${.TARGET}.o
- @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
- @rm -f ${.TARGET}.o
MAN+= __get_tcb.2 __thrsigdivert.2 __thrsleep.2 _exit.2 accept.2 \
access.2 acct.2 adjfreq.2 adjtime.2 bind.2 brk.2 chdir.2 \