Page MenuHomeFreeBSD

libsysdecode: automate tables.h dependency generation
AbandonedPublic

Authored by emaste on Jul 25 2019, 4:16 PM.

Details

Summary

Add a -d option to mktables to emit the dependency list, and invoke it from the Makefile to add the result (with the include directory prepended) to the tables.h dependency list.

PR: 238828

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

emaste created this revision.Jul 25 2019, 4:16 PM
emaste added inline comments.
lib/libsysdecode/Makefile
127–130

@bdrewery does this need to be wrapped in a .if !defined(_SKIP_BUILD)?

imp added a subscriber: imp.Aug 16 2019, 3:13 PM
imp added inline comments.
lib/libsysdecode/Makefile
127–130

I think it does, but I'm far from certain.

emaste added inline comments.Aug 16 2019, 3:33 PM
lib/libsysdecode/Makefile
127–130

It should only be a perf issue if not there I think, but some testing (to the extent that I understand this part of the build system) suggests it works with a _SKIP_BUILD test here.

emaste updated this revision to Diff 60895.Aug 16 2019, 3:37 PM

Wrap in .if !defined(_SKIP_BUILD)

bdrewery added inline comments.Aug 16 2019, 7:43 PM
lib/libsysdecode/Makefile
127–130

Yes please. _SKIP_BUILD is for some treewalks that are not building anything so don't need to know dependencies.

Having said that I don't see this this change is needed. There's already a .depend file here for this exact thing. rS308602 was the start of that.

bdrewery requested changes to this revision.Aug 16 2019, 7:43 PM

This already has .depend file support. Why is this needed?

~/git/freebsd2/lib/libsysdecode # less obj/.depend.tables.h.tmp
tables.h.tmp: \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/aio.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/netgraph/bluetooth/include/ng_btsocket.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/netinet/in.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/netinet/sctp.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/netinet/sctp_uio.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/netinet/tcp.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/netinet/udp.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/netinet/udplite.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/netinet6/in6.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/nfs/nfssvc.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sched.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/acl.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/capsicum.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/event.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/extattr.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/fcntl.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/linker.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/mman.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/mount.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/procctl.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/ptrace.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/reboot.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/resource.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/rtprio.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/shm.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/signal.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/socket.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/stat.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/thr.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/umtx.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/unistd.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/sys/wait.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/ufs/ufs/quota.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/vm/vm.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/vm/vm_param.h \
        /scratch/obj/root/git/freebsd2/amd64.amd64/tmp/usr/include/x86/sysarch.h \
This revision now requires changes to proceed.Aug 16 2019, 7:43 PM

The hacks to using tables.h.tmp is probably what broke my work.

Something like this is probably needed instead

~/git/freebsd2/lib/libsysdecode # git diff
diff --git lib/libsysdecode/Makefile lib/libsysdecode/Makefile
index 2be244a6da46..9edfe067063c 100644
--- lib/libsysdecode/Makefile
+++ lib/libsysdecode/Makefile
@@ -127,7 +127,8 @@ incdir=${SYSROOT:U${DESTDIR}}${INCLUDEDIR}
 tables.h: mktables ${incdir}/netinet/in.h ${incdir}/netinet/tcp.h \
     ${incdir}/netinet6/in6.h
        sh ${.CURDIR}/mktables ${incdir} ${.TARGET}.tmp && \
-           mv -f ${.TARGET}.tmp ${.TARGET}
+           mv -f ${.TARGET}.tmp ${.TARGET} && \
+           mv -f .depend.${.TARGET}.tmp .depend.${.TARGET}

And the tables.h.tmp: needs to be tables.h: in the depend file.

Really just stop the .tmp nonsense somehow.

My change is at D21295

emaste abandoned this revision.Aug 16 2019, 8:16 PM