all: iswydt-bot
VALAC = valac
LIBS := gee-1.0 loudmouth-1.0
VALAONLYLIBS := posix
VALALIBS := $(patsubst %, --pkg %, $(LIBS) $(VALAONLYLIBS))
VFLAGS = -g
SOURCES = iswydt.vala config.vala simple_iq.vala muc.vala muc_log.vala muc_commands.vala version.vala
version.vala: .
echo "static const string IswydtVersion = \"$$(hg id -bnit)\";" > version.vala
iswydt-bot: $(SOURCES)
$(VALAC) $(VFLAGS) $(VALALIBS) -o $@ $^
cfiles: $(SOURCES)
$(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