LD := $(CXX)
LDFLAGS := @LDFLAGS@
LIBS := @LIBS@
-LINK := $(LD) $(LDFLAGS) -Wl,-rpath,$(install_libs_dir) $(patsubst -L%,-Wl$(comma)-rpath$(comma)%,$(filter -L%,$(LDFLAGS)))
+LINK := $(LD) -L. $(LDFLAGS) -Wl,-rpath,$(install_libs_dir) $(patsubst -L%,-Wl$(comma)-rpath$(comma)%,$(filter -L%,$(LDFLAGS)))
# Library creation
# Build the object files for this subproject
+$(2)_pch := $$(patsubst %.h, %.h.gch, $$($(2)_precompiled_hdrs))
$(2)_objs := $$(patsubst %.cc, %.o, $$($(2)_srcs))
$(2)_c_objs := $$(patsubst %.c, %.o, $$($(2)_c_srcs))
$(2)_deps := $$(patsubst %.o, %.d, $$($(2)_objs))
$(2)_c_deps := $$(patsubst %.o, %.d, $$($(2)_c_objs))
-$$($(2)_objs) : %.o : %.cc $$($(2)_gen_hdrs)
+$$($(2)_pch) : %.h.gch : %.h
+ $(COMPILE) $$<
+$$($(2)_objs) : %.o : %.cc $$($(2)_gen_hdrs) $$($(2)_pch)
$(COMPILE) -c $$<
$$($(2)_c_objs) : %.o : %.c $$($(2)_gen_hdrs)
$(COMPILE_C) -c $$<
-$(2)_junk += $$($(2)_objs) $$($(2)_c_objs) $$($(2)_deps) $$($(2)_c_deps) $$($(2)_gen_hdrs)
+$(2)_junk += $$(addprefix $(src_dir)/$(1)/, $$($(2)_pch)) \
+ $$($(2)_objs) $$($(2)_c_objs) $$($(2)_deps) $$($(2)_c_deps) $$($(2)_gen_hdrs)
# Reverse the dependency list so that a given subproject only depends on
# subprojects listed to its right. This is the correct order for linking
$(2)_lib_libs := $$($(2)_reverse_deps)
$(2)_lib_libnames := $$(patsubst %, lib%.so, $$($(2)_lib_libs))
-$(2)_lib_libarg := -L. $$(patsubst %, -l%, $$($(2)_lib_libs))
+$(2)_lib_libarg := $$(patsubst %, -l%, $$($(2)_lib_libs))
lib$(1).so : $$($(2)_objs) $$($(2)_c_objs) $$($(2)_lib_libnames)
$(LINK) -shared -o $$@ $(if $(filter Darwin,$(shell uname -s)),-install_name $(install_libs_dir)/$$@) $$^ $$($(2)_lib_libarg) $(LIBS)
$(2)_test_outs := $$(patsubst %, %.out, $$($(2)_test_exes))
$(2)_test_libs := $(1) $$($(2)_reverse_deps) utst
$(2)_test_libnames := $$(patsubst %, lib%.so, $$($(2)_test_libs))
-$(2)_test_libarg := -L. $$(patsubst %, -l%, $$($(2)_test_libs))
+$(2)_test_libarg := $$(patsubst %, -l%, $$($(2)_test_libs))
$$($(2)_test_objs) : %.o : %.cc
$(COMPILE) -c $$<
$(2)_prog_exes := $$(patsubst %.cc, %, $$($(2)_prog_srcs))
$(2)_prog_libs := $(1) $$($(2)_reverse_deps)
$(2)_prog_libnames := $$(patsubst %, lib%.so, $$($(2)_prog_libs))
-$(2)_prog_libarg := -L. $$(patsubst %, -l%, $$($(2)_prog_libs))
+$(2)_prog_libarg := $$(patsubst %, -l%, $$($(2)_prog_libs))
$$($(2)_prog_objs) : %.o : %.cc
$(COMPILE) -c $$<