From 4796bec4413d3d791117bd9cd9bcdd5fa1b24844 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 24 Jul 2016 23:50:26 -0700 Subject: [PATCH] Activate PCH for position independent code. Cuts compilation time by 30%+ --- extensions/Makefile.am | 4 ++++ include/rb/.gitignore | 1 + include/rb/Makefile.am | 8 +++++++- ircd/Makefile.am | 4 ++++ modules/Makefile.am | 4 ++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 562cb5865..977d12215 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -5,6 +5,10 @@ AM_CPPFLAGS = \ $(LTDLINCL) \ @BOOST_CPPFLAGS@ +if BUILD_PCH +AM_CPPFLAGS += -include $(top_srcdir)/include/rb/rb.pic.h +endif + AM_LDFLAGS = \ -L$(top_srcdir)/ircd \ -L$(top_srcdir)/rb \ diff --git a/include/rb/.gitignore b/include/rb/.gitignore index e8daa4398..feea7f655 100644 --- a/include/rb/.gitignore +++ b/include/rb/.gitignore @@ -1 +1,2 @@ config.h* +rb.pic.h diff --git a/include/rb/Makefile.am b/include/rb/Makefile.am index 3d1513c31..49484ad4d 100644 --- a/include/rb/Makefile.am +++ b/include/rb/Makefile.am @@ -7,14 +7,20 @@ AM_CXXFLAGS = -fpch-deps endif if BUILD_PCH -BUILT_SOURCES = rb.h.gch +BUILT_SOURCES = rb.h.gch rb.pic.h.gch endif rb.h.gch: $(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) -o rb.h.gch $(DEFS) $(CPPFLAGS) $(AM_CPPFLAGS) rb.h +rb.pic.h.gch: + cp rb.h rb.pic.h + $(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) -fPIC -o rb.pic.h.gch $(DEFS) $(CPPFLAGS) $(AM_CPPFLAGS) rb.pic.h + clean-local: rm -f rb.h.gch + rm -f rb.pic.h + rm -f rb.pic.h.gch mrproper-local: rm -f config.h diff --git a/ircd/Makefile.am b/ircd/Makefile.am index 319d9a1a4..478622d4c 100644 --- a/ircd/Makefile.am +++ b/ircd/Makefile.am @@ -11,6 +11,10 @@ AM_CPPFLAGS = \ @LTDLINCL@ \ @BOOST_CPPFLAGS@ +if BUILD_PCH +AM_CPPFLAGS += -include $(top_srcdir)/include/rb/rb.pic.h +endif + if MINGW PLATFORM_LDFLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' endif diff --git a/modules/Makefile.am b/modules/Makefile.am index cdd570341..d6d182c0b 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -6,6 +6,10 @@ AM_CPPFLAGS = \ $(LTDLINCL) \ @BOOST_CPPFLAGS@ +if BUILD_PCH +AM_CPPFLAGS += -include $(top_srcdir)/include/rb/rb.pic.h +endif + AM_LDFLAGS = \ -L$(top_srcdir)/ircd \ -L$(top_srcdir)/rb \