On Wed, Sep 12, 2012 at 10:33:24AM -0700, Matthew Dempsky wrote:
> This diff is super hacky and just mailed out for proof-of-concept, but
> it's something that's been handy for me while hacking on ld.so.
> Basically before installing a new version of ld.so, it just runs a
> simple test program to double check that ld.so isn't completely hosed.
>
> There's plenty of issues with this diff as is (e.g., doesn't work for
> cross builds, assumes "make obj", "make clean" doesn't work), but I'm
> curious what people think of the concept and whether anyone has
> suggestions how to improve it.
Use beforeinstall instead of adding another target.
'make clean' should be easy to do, just add what you built to CLEANFILES...
you may wish to move the building part of sanitycheckprog to build, not
beforeinstall...
oh, and use .OBJDIR, then it doesn't matter if you forgot to run obj.
e.g.,
test a fragment like that:
OBJ2= sanitycheckprog.o
P2= sanitycheckprog
# XXX native build only
.if !defined(HOSTCC)
all: ${P2}
${P2}: ${OBJ2}
$(CC) -o $@ ${OBJ2} -Wl,--dynamic-linker,${.OBJDIR}/$(PROG)
beforeinstall:
./${P2}
.endif
CLEANFILES += ${P2} ${OBJ2}