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.

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