changeset 3429:05b732174e5f trunk

precompiled headers (part 1)
author William Pitcock <nenolod@atheme.org>
date Fri, 07 Sep 2007 00:17:57 -0500
parents 820c2db12041
children 91c27073aa13
files configure.ac mk/objective.mk mk/rules.mk.in src/audacious/Makefile
diffstat 4 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sun Sep 02 16:24:31 2007 -0500
+++ b/configure.ac	Fri Sep 07 00:17:57 2007 -0500
@@ -40,7 +40,11 @@
 AC_ISC_POSIX
 AC_C_BIGENDIAN
 
+dnl If we have GCC, build pre-compiled headers to speed compilation times.
+PCH=""
 test x"$GCC" = x"yes" && CFLAGS="$CFLAGS -Wall -pipe"
+test x"$GCC" = x"yes" && PCH="pch"
+AC_SUBST(PCH)
 
 dnl Check for assembler
 
--- a/mk/objective.mk	Sun Sep 02 16:24:31 2007 -0500
+++ b/mk/objective.mk	Fri Sep 07 00:17:57 2007 -0500
@@ -209,6 +209,16 @@
 	fi;
 	$(CXX) $(CXXFLAGS) -c $< -o $@
 
+pch:
+	@for i in *.h; do \
+		if [ $(SHOW_CFLAGS) -eq 1 ]; then	\
+			printf "%10s     %-20s (%s)\n" "CC [HDR]" $$i "${CFLAGS}";	\
+		else \
+			printf "%10s     %-20s\n" "CC [HDR]" $$i;	\
+		fi; \
+		$(CC) $(CFLAGS) -c $$i -o $$i.gch; \
+	done
+
 $(OBJECTIVE_LIBS): $(OBJECTS)
 	if [ "x$(OBJECTS)" != "x" ]; then \
 		$(MAKE) $(OBJECTS) || exit;		\
--- a/mk/rules.mk.in	Sun Sep 02 16:24:31 2007 -0500
+++ b/mk/rules.mk.in	Fri Sep 07 00:17:57 2007 -0500
@@ -339,3 +339,4 @@
 LIBAUDCLIENT_OBJECTIVE ?= @LIBAUDCLIENT_OBJECTIVE@
 TRANSPORT_PLUGIN_DIR ?= @TRANSPORT_PLUGIN_DIR@
 TRANSPORT_PLUGINS ?= @TRANSPORT_PLUGINS@
+PCH ?= @PCH@
--- a/src/audacious/Makefile	Sun Sep 02 16:24:31 2007 -0500
+++ b/src/audacious/Makefile	Fri Sep 07 00:17:57 2007 -0500
@@ -1,6 +1,5 @@
 include ../../mk/rules.mk
 include ../../mk/init.mk
-include ../../mk/objective.mk
 
 SUBDIRS = $(INTL_OBJECTIVE) glade images ui
 
@@ -182,9 +181,7 @@
 desktop_DATA = audacious.desktop
 desktopdir = $(datadir)/applications
 
-audacious: $(OBJECTS) $(LIBDEP)
-	$(CXX) $(LDFLAGS) $(OBJECTS) $(LDADD) -o $@ 
-	@printf "%10s     %-20s\n" LINK $@
+build-prehook: $(PCH)
 
 dbus-server-bindings.h: $(DBUS_BINDINGS_SOURCES)
 	$(DBUS_BINDING_TOOL) --mode=glib-server --prefix=audacious_rc objects.xml > $@
@@ -198,3 +195,5 @@
 	@printf "%10s     %-20s\n" DBUS-BIND $@
 
 OBJECTIVE_DATA = audacious.desktop:$(datadir)/applications
+
+include ../../mk/objective.mk