Makefile 725 B

123456789101112131415161718192021222324252627282930313233
  1. BUILD := .build
  2. BIN := zsnapper node_modules
  3. SMF := zsnapper.xml
  4. ETC := zsnapper.json.sample
  5. TAR := smartos-zsnapper.tar.gz
  6. UID = $(shell id -u)
  7. smartos: $(TAR)
  8. $(TAR): $(BIN) $(SMF) $(ETC) $(BUILD)/opt/local/bin $(BUILD)/opt/local/etc $(BUILD)/opt/custom/smf
  9. ifneq ($(UID), 0)
  10. $(error Should run as uid 0 for correct file ownership; consider fakeroot)
  11. endif
  12. cp -r $(BIN) $(BUILD)/opt/local/bin
  13. cp -r $(ETC) $(BUILD)/opt/local/etc
  14. cp -r $(SMF) $(BUILD)/opt/custom/smf
  15. chown -R 0:0 $(BUILD)
  16. tar -C $(BUILD) -zcf $@ opt
  17. node_modules:
  18. npm install
  19. $(BUILD)/opt/local/bin:
  20. mkdir -p $@
  21. $(BUILD)/opt/local/etc:
  22. mkdir -p $@
  23. $(BUILD)/opt/custom/smf:
  24. mkdir -p $@
  25. clean:
  26. rm -rf .build $(TAR) node_modules
  27. .PHONY: clean