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.

65 lines
1.2KB

  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. DISTRIBUTABLES += plugin.json
  7. FLAGS += -fPIC
  8. FLAGS += -I$(RACK_DIR)/include -I$(RACK_DIR)/dep/include
  9. include $(RACK_DIR)/arch.mk
  10. ifdef ARCH_LIN
  11. LDFLAGS += -shared
  12. TARGET := plugin.so
  13. RACK_USER_DIR ?= $(HOME)/.Rack
  14. endif
  15. ifdef ARCH_MAC
  16. LDFLAGS += -shared -undefined dynamic_lookup
  17. TARGET := plugin.dylib
  18. RACK_USER_DIR ?= $(HOME)/Documents/Rack
  19. endif
  20. ifdef ARCH_WIN
  21. LDFLAGS += -shared -L$(RACK_DIR) -lRack
  22. TARGET := plugin.dll
  23. RACK_USER_DIR ?= $(USERPROFILE)/Documents/Rack
  24. endif
  25. DEP_FLAGS += -fPIC
  26. include $(RACK_DIR)/dep.mk
  27. all: $(TARGET)
  28. include $(RACK_DIR)/compile.mk
  29. clean:
  30. rm -rfv build $(TARGET) dist
  31. dist: all
  32. rm -rf dist
  33. mkdir -p dist/$(SLUG)
  34. @# Strip and copy plugin binary
  35. cp $(TARGET) dist/$(SLUG)/
  36. ifdef ARCH_MAC
  37. $(STRIP) -S dist/$(SLUG)/$(TARGET)
  38. else
  39. $(STRIP) -s dist/$(SLUG)/$(TARGET)
  40. endif
  41. @# Copy distributables
  42. cp -R $(DISTRIBUTABLES) dist/$(SLUG)/
  43. @# Create ZIP package
  44. cd dist && zip -5 -r $(SLUG)-$(VERSION)-$(ARCH).zip $(SLUG)
  45. install: dist
  46. cp dist/$(SLUG)-$(VERSION)-$(ARCH).zip $(RACK_USER_DIR)/plugins/
  47. .PHONY: clean dist
  48. .DEFAULT_GOAL := all