From 7152e5efbb0fade868d5f2d2c7bc10ed52b3d19d Mon Sep 17 00:00:00 2001 From: Jan Moskyto Matejka Date: Tue, 12 Apr 2016 11:14:54 +0200 Subject: Build system reworked to one global Makefile with includes and no nesting Also removed the lib-dir merging with sysdep. Updated #include's accordingly. Fixed make doc on recent Debian together with moving generated doc into objdir. Moved Makefile.in into root dir Retired all.o and birdlib.a Linking the final binaries directly from all the .o files. --- sysdep/bsd/Makefile | 5 +++++ sysdep/bsd/Modules | 4 ---- sysdep/bsd/krt-sock.c | 6 +++--- sysdep/cf/bsd.h | 3 +++ sysdep/cf/linux.h | 5 +++++ sysdep/linux/Makefile | 4 ++++ sysdep/linux/Modules | 5 ----- sysdep/linux/netlink.c | 6 +++--- sysdep/unix/Makefile | 5 +++++ sysdep/unix/Modules | 12 ------------ sysdep/unix/config.Y | 2 +- sysdep/unix/io.c | 6 +++--- sysdep/unix/krt.Y | 2 +- sysdep/unix/krt.c | 2 +- sysdep/unix/krt.h | 5 +++-- sysdep/unix/log.c | 2 +- sysdep/unix/main.c | 6 +++++- sysdep/unix/unix.h | 6 +++--- 18 files changed, 46 insertions(+), 40 deletions(-) create mode 100644 sysdep/bsd/Makefile delete mode 100644 sysdep/bsd/Modules create mode 100644 sysdep/linux/Makefile delete mode 100644 sysdep/linux/Modules create mode 100644 sysdep/unix/Makefile delete mode 100644 sysdep/unix/Modules (limited to 'sysdep') diff --git a/sysdep/bsd/Makefile b/sysdep/bsd/Makefile new file mode 100644 index 00000000..ddc87239 --- /dev/null +++ b/sysdep/bsd/Makefile @@ -0,0 +1,5 @@ +src := krt-sock.c +obj := $(src-o-files) +$(all-daemon) +$(conf-y-targets): $(s)krt-sock.Y + diff --git a/sysdep/bsd/Modules b/sysdep/bsd/Modules deleted file mode 100644 index 96455db7..00000000 --- a/sysdep/bsd/Modules +++ /dev/null @@ -1,4 +0,0 @@ -krt-sock.c -krt-sock.Y -krt-sys.h -sysio.h diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index 5f2f1309..c6456838 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -28,9 +28,9 @@ #include "nest/route.h" #include "nest/protocol.h" #include "nest/iface.h" -#include "lib/timer.h" -#include "lib/unix.h" -#include "lib/krt.h" +#include "sysdep/unix/timer.h" +#include "sysdep/unix/unix.h" +#include "sysdep/unix/krt.h" #include "lib/string.h" #include "lib/socket.h" diff --git a/sysdep/cf/bsd.h b/sysdep/cf/bsd.h index 51beb42b..22c54277 100644 --- a/sysdep/cf/bsd.h +++ b/sysdep/cf/bsd.h @@ -15,6 +15,9 @@ #define CONFIG_NO_IFACE_BIND #define CONFIG_USE_HDRINCL +#define CONFIG_INCLUDE_SYSIO_H "sysdep/bsd/sysio.h" +#define CONFIG_INCLUDE_KRTSYS_H "sysdep/bsd/krt-sys.h" + /* Link: sysdep/unix Link: sysdep/bsd diff --git a/sysdep/cf/linux.h b/sysdep/cf/linux.h index 9e34f869..cec9499c 100644 --- a/sysdep/cf/linux.h +++ b/sysdep/cf/linux.h @@ -14,7 +14,12 @@ #define CONFIG_MC_PROPER_SRC #define CONFIG_UNIX_DONTROUTE +#define CONFIG_INCLUDE_SYSIO_H "sysdep/linux/sysio.h" +#define CONFIG_INCLUDE_KRTSYS_H "sysdep/linux/krt-sys.h" + #define CONFIG_RESTRICTED_PRIVILEGES +#define CONFIG_INCLUDE_SYSPRIV_H "sysdep/linux/syspriv.h" + /* Link: sysdep/linux diff --git a/sysdep/linux/Makefile b/sysdep/linux/Makefile new file mode 100644 index 00000000..23cf1d9d --- /dev/null +++ b/sysdep/linux/Makefile @@ -0,0 +1,4 @@ +src := netlink.c +obj := $(src-o-files) +$(all-daemon) +$(conf-y-targets): $(s)netlink.Y diff --git a/sysdep/linux/Modules b/sysdep/linux/Modules deleted file mode 100644 index 940660b6..00000000 --- a/sysdep/linux/Modules +++ /dev/null @@ -1,5 +0,0 @@ -krt-sys.h -netlink.c -netlink.Y -sysio.h -syspriv.h diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c index 6240c177..6cf40484 100644 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@ -20,9 +20,9 @@ #include "nest/protocol.h" #include "nest/iface.h" #include "lib/alloca.h" -#include "lib/timer.h" -#include "lib/unix.h" -#include "lib/krt.h" +#include "sysdep/unix/timer.h" +#include "sysdep/unix/unix.h" +#include "sysdep/unix/krt.h" #include "lib/socket.h" #include "lib/string.h" #include "lib/hash.h" diff --git a/sysdep/unix/Makefile b/sysdep/unix/Makefile new file mode 100644 index 00000000..c5d55431 --- /dev/null +++ b/sysdep/unix/Makefile @@ -0,0 +1,5 @@ +src := io.c krt.c log.c main.c random.c +obj := $(src-o-files) +$(all-daemon) +$(cf-local) +$(conf-y-targets): $(s)krt.Y diff --git a/sysdep/unix/Modules b/sysdep/unix/Modules deleted file mode 100644 index 2c6514df..00000000 --- a/sysdep/unix/Modules +++ /dev/null @@ -1,12 +0,0 @@ -log.c -main.c -timer.h -io.c -unix.h -endian.h -config.Y -random.c - -krt.c -krt.h -krt.Y diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y index f9a92900..ebadd454 100644 --- a/sysdep/unix/config.Y +++ b/sysdep/unix/config.Y @@ -8,7 +8,7 @@ CF_HDR -#include "lib/unix.h" +#include "sysdep/unix/unix.h" #include CF_DECLS diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index cbfb47d5..afa51be7 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -31,14 +31,14 @@ #include "nest/bird.h" #include "lib/lists.h" #include "lib/resource.h" -#include "lib/timer.h" +#include "sysdep/unix/timer.h" #include "lib/socket.h" #include "lib/event.h" #include "lib/string.h" #include "nest/iface.h" -#include "lib/unix.h" -#include "lib/sysio.h" +#include "sysdep/unix/unix.h" +#include CONFIG_INCLUDE_SYSIO_H /* Maximum number of calls of tx handler for one socket in one * select iteration. Should be small enough to not monopolize CPU by diff --git a/sysdep/unix/krt.Y b/sysdep/unix/krt.Y index 1cd73502..91317d97 100644 --- a/sysdep/unix/krt.Y +++ b/sysdep/unix/krt.Y @@ -8,7 +8,7 @@ CF_HDR -#include "lib/krt.h" +#include "sysdep/unix/krt.h" CF_DEFINES diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 6b3b4eee..38f31235 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -56,7 +56,7 @@ #include "nest/route.h" #include "nest/protocol.h" #include "filter/filter.h" -#include "lib/timer.h" +#include "sysdep/unix/timer.h" #include "conf/conf.h" #include "lib/string.h" diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h index e968ad57..cb404de3 100644 --- a/sysdep/unix/krt.h +++ b/sysdep/unix/krt.h @@ -15,7 +15,8 @@ struct krt_proto; struct kif_config; struct kif_proto; -#include "lib/krt-sys.h" +#include "sysdep/config.h" +#include CONFIG_INCLUDE_KRTSYS_H /* Flags stored in net->n.flags, rest are in nest/route.h */ @@ -111,7 +112,7 @@ struct kif_proto { struct kif_state sys; /* Sysdep state */ }; -struct kif_proto *kif_proto; +extern struct kif_proto *kif_proto; #define KIF_CF ((struct kif_config *)p->p.cf) diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c index 7cb26360..8daff034 100644 --- a/sysdep/unix/log.c +++ b/sysdep/unix/log.c @@ -26,7 +26,7 @@ #include "nest/mrtdump.h" #include "lib/string.h" #include "lib/lists.h" -#include "lib/unix.h" +#include "sysdep/unix/unix.h" static FILE *dbgf; static list *current_log_list; diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 8796ab9c..14b3b2f6 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -69,7 +69,7 @@ async_dump(void) */ #ifdef CONFIG_RESTRICTED_PRIVILEGES -#include "lib/syspriv.h" +#include CONFIG_INCLUDE_SYSPRIV_H #else static inline void @@ -567,6 +567,10 @@ sysdep_shutdown_done(void) * Signals */ +volatile int async_config_flag; +volatile int async_dump_flag; +volatile int async_shutdown_flag; + static void handle_sighup(int sig UNUSED) { diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h index 414b6ca4..80c99350 100644 --- a/sysdep/unix/unix.h +++ b/sysdep/unix/unix.h @@ -91,9 +91,9 @@ int sockaddr_read(sockaddr *sa, int af, ip_addr *a, struct iface **ifa, uint *po #define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen ((ptr)->sun_path)) #endif -volatile int async_config_flag; -volatile int async_dump_flag; -volatile int async_shutdown_flag; +extern volatile int async_config_flag; +extern volatile int async_dump_flag; +extern volatile int async_shutdown_flag; void io_init(void); void io_loop(void); -- cgit v1.2.3