--- a/.hgignore Wed Oct 24 14:08:16 2012 +0400
+++ b/.hgignore Wed Oct 24 15:07:07 2012 +0400
@@ -1,3 +1,4 @@
^config.ini$
^iswydt-bot$
.swp$
+^cfiles/
--- a/Makefile Wed Oct 24 14:08:16 2012 +0400
+++ b/Makefile Wed Oct 24 15:07:07 2012 +0400
@@ -1,10 +1,22 @@
all: iswydt-bot
VALAC = valac
-LIBS := gee-1.0 loudmouth-1.0 posix
-VALALIBS := $(patsubst %, --pkg %, $(LIBS))
+LIBS := gee-1.0 loudmouth-1.0
+VALAONLYLIBS := posix
+VALALIBS := $(patsubst %, --pkg %, $(LIBS) $(VALAONLYLIBS))
VFLAGS = -g
iswydt-bot: iswydt.vala config.vala muc.vala muc_log.vala
$(VALAC) $(VFLAGS) $(VALALIBS) -o $@ $^
+cfiles: iswydt.vala config.vala muc.vala muc_log.vala
+ $(VALAC) $(VFLAGS) $(VALALIBS) -C $^
+ mkdir -p cfiles
+ mv *.c cfiles/
+ cd cfiles
+ echo 'LIBS := `pkg-config --libs $(LIBS)`' > cfiles/Makefile
+ echo 'CFLAGS := `pkg-config --cflags $(LIBS)`' >> cfiles/Makefile
+ echo "iswydt-bot: $(subst vala,c,$^)" >> cfiles/Makefile
+ echo ' $$(CC) -o iswydt-bot $$(LIBS) $$(CFLAGS) $$^' >> cfiles/Makefile
+
+.PHONY: cfiles