moth/packages/packages.mk

41 lines
847 B
Makefile
Raw Normal View History

2010-10-21 22:15:18 -06:00
PACKAGES =
define COPYTREE
mkdir -p $(2)
(cd $(1) && find . -not -name "*~" | cpio -o) | (cd $(2) && cpio -i)
endef
define STANDARD_PUZZLE
t=$(strip $1)
2011-01-04 12:35:15 -07:00
$t-install: $(TARGET)/$t
$(TARGET)/$t: packages/$t
2010-10-25 17:17:10 -06:00
mkdir -p $(TARGET)/$t
./mkpuzzles packages/$t $(TARGET)/$t
2010-10-21 22:15:18 -06:00
2010-10-22 15:03:51 -06:00
$t-clean: $t-stdclean
$t-stdclean:
2010-10-25 17:17:10 -06:00
rm -rf $(TARGET)/$t $(BIN)/$t.pkg
2010-10-21 22:15:18 -06:00
PACKAGES += $t
endef
include packages/*/*.mk
# Make foo depend on foo.pkg
$(foreach p, $(PACKAGES), $(eval $p: $(BIN)/$p.pkg))
packages: $(patsubst %, $(BIN)/%.pkg, $(PACKAGES))
2010-10-25 17:17:10 -06:00
packages-install: $(addsuffix -install, $(PACKAGES))
2010-10-21 22:15:18 -06:00
2010-10-25 17:17:10 -06:00
packages-clean: $(addsuffix -clean, $(PACKAGES))
rm -rf $(TARGET) $(BIN)
2010-10-21 22:15:18 -06:00
$(foreach p, $(PACKAGES), $(eval $p-clean: $p-pkgclean))
%-pkgclean:
rm -f $(BIN)/$*.pkg
$(BIN)/%.pkg: %-install
@ mkdir -p $(@D)
2010-10-25 17:17:10 -06:00
mksquashfs $(TARGET)/$* $@ -all-root -noappend -no-progress