#
objects = $(patsubst %.c,$(builddir)/%.o,$(patsubst %.cc,$(builddir)/%.o,$(wildcard $d/*.c $d/*.cc)))
-$(objects): TGT_CFLAGS := -I$d -I$d/..
-$(objects): config.h $(this) | $b
+$(objects): TGT_CFLAGS := -I$b -I$b/.. -I$d -I$d/..
+$(objects): config.h | $b
library = $b/libmoof.a
$(library): $(objects)
$(Q)$(ar)
+ifeq (true,$(pch))
+pchfile := $b/precompile.hh
+exec += $(pchfile) $(pchfile).gch
+$(pchfile).gch: TGT_CFLAGS := -I$b -I$b/.. -I$d -I$d/..
+$(pchfile).gch: $(pchfile)
+$(pchfile): config.mk | $b
+$(objects): $(pchfile).gch
+endif
+
exec += $(objects) $(library)