libstand: Rework makefile to avoid repeated building
authorJohn Marino <draco@marino.st>
Mon, 23 Mar 2015 13:39:27 +0000 (14:39 +0100)
committerJohn Marino <draco@marino.st>
Mon, 23 Mar 2015 16:09:45 +0000 (17:09 +0100)
The change to use i386 headers for x86_64 was like a sledgehammer.
From my investigation, "cpu" is not needed at all, and only four headers
are needed from "machine".  The "cpu" directory is still created so that
if some attempt to "#include <cpu/xxx>" is made, it will fail.

By adding exact header dependencies, we prevent libstand from building
over and over again in quickworld.

lib/libstand/Makefile

index b40bc55..5207091 100644 (file)
@@ -103,15 +103,21 @@ SRCS+=    hammer2.c
 .if ${MACHINE_ARCH} == "x86_64"
 CFLAGS+= -I${.OBJDIR}
 
-beforedepend ${OBJS}: machine cpu
+.PATH: ${.OBJDIR}/machine
 
-machine::
+in_cksum.c: endian.h stdint.h
+stand.h:    stdarg.h
+_setjmp.S:  asm.h
+
+endian.h stdint.h asm.h stdarg.h:
        mkdir -p machine
-       ${LN} -fs ${.CURDIR}/../../sys/cpu/i386/include/* machine
-       ${LN} -fs ${.CURDIR}/../../sys/platform/pc32/include/* machine
+       ${LN} -fs ${.CURDIR}/../../sys/cpu/i386/include/${.TARGET:T} \
+               machine/${.TARGET:T}
+
+cpu:
+       mkdir -p ${.TARGET}
 
-cpu::
-       ${LN} -hfs ${.CURDIR}/../../sys/cpu/i386/include cpu
+beforedepend: cpu
 
 CLEANDIRS+=    machine cpu
 .endif