Makefile 708 B

12345678910111213141516171819202122232425262728293031
  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. $(TAR): $(BIN) $(SMF) $(ETC) $(BUILD)/opt/local/bin $(BUILD)/opt/local/etc $(BUILD)/opt/custom/smf
  8. ifneq ($(UID), 0)
  9. $(error Should run as uid 0 for correct file ownership; consider fakeroot)
  10. endif
  11. cp -r $(BIN) $(BUILD)/opt/local/bin
  12. cp -r $(ETC) $(BUILD)/opt/local/etc
  13. cp -r $(SMF) $(BUILD)/opt/custom/smf
  14. chown -R 0:0 $(BUILD)
  15. tar -C $(BUILD) -zcf $@ opt
  16. node_modules:
  17. npm install
  18. $(BUILD)/opt/local/bin:
  19. mkdir -p $@
  20. $(BUILD)/opt/local/etc:
  21. mkdir -p $@
  22. $(BUILD)/opt/custom/smf:
  23. mkdir -p $@
  24. clean:
  25. rm -rf .build $(TAR) node_modules
  26. .PHONY: clean