You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.3KB

  1. ifndef RACK_DIR
  2. $(error RACK_DIR is not defined)
  3. endif
  4. SLUG := $(shell jq .slug plugin.json)
  5. VERSION := $(shell jq .version plugin.json)
  6. ifndef SLUG
  7. $(error SLUG could not be found in manifest)
  8. endif
  9. ifndef VERSION
  10. $(error VERSION could not be found in manifest)
  11. endif
  12. DISTRIBUTABLES += plugin.json
  13. FLAGS += -fPIC
  14. FLAGS += -I$(RACK_DIR)/include -I$(RACK_DIR)/dep/include
  15. include $(RACK_DIR)/arch.mk
  16. ifdef ARCH_LIN
  17. LDFLAGS += -shared
  18. TARGET := plugin.so
  19. RACK_USER_DIR ?= $(HOME)/.Rack
  20. endif
  21. ifdef ARCH_MAC
  22. LDFLAGS += -shared -undefined dynamic_lookup
  23. TARGET := plugin.dylib
  24. RACK_USER_DIR ?= $(HOME)/Documents/Rack
  25. endif
  26. ifdef ARCH_WIN
  27. LDFLAGS += -shared -L$(RACK_DIR) -lRack
  28. TARGET := plugin.dll
  29. RACK_USER_DIR ?= "$(USERPROFILE)"/Documents/Rack
  30. endif
  31. DEP_FLAGS += -fPIC
  32. include $(RACK_DIR)/dep.mk
  33. all: $(TARGET)
  34. include $(RACK_DIR)/compile.mk
  35. clean:
  36. rm -rfv build $(TARGET) dist
  37. dist: all
  38. rm -rf dist
  39. mkdir -p dist/$(SLUG)
  40. @# Strip and copy plugin binary
  41. cp $(TARGET) dist/$(SLUG)/
  42. ifdef ARCH_MAC
  43. $(STRIP) -S dist/$(SLUG)/$(TARGET)
  44. else
  45. $(STRIP) -s dist/$(SLUG)/$(TARGET)
  46. endif
  47. @# Copy distributables
  48. cp -R $(DISTRIBUTABLES) dist/$(SLUG)/
  49. @# Create ZIP package
  50. cd dist && zip -5 -r $(SLUG)-$(VERSION)-$(ARCH).zip $(SLUG)
  51. install: dist
  52. cp dist/$(SLUG)-$(VERSION)-$(ARCH).zip $(RACK_USER_DIR)/plugins/
  53. .PHONY: clean dist
  54. .DEFAULT_GOAL := all