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.

plugin.mk 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. # Link to glibc 2.23
  21. # FLAGS += -include force_link_glibc_2.23.h
  22. endif
  23. ifdef ARCH_MAC
  24. LDFLAGS += -shared -undefined dynamic_lookup
  25. TARGET := plugin.dylib
  26. RACK_USER_DIR ?= $(HOME)/Documents/Rack
  27. endif
  28. ifdef ARCH_WIN
  29. LDFLAGS += -shared -L$(RACK_DIR) -lRack
  30. TARGET := plugin.dll
  31. RACK_USER_DIR ?= "$(USERPROFILE)"/Documents/Rack
  32. endif
  33. DEP_FLAGS += -fPIC
  34. include $(RACK_DIR)/dep.mk
  35. all: $(TARGET)
  36. include $(RACK_DIR)/compile.mk
  37. clean:
  38. rm -rfv build $(TARGET) dist
  39. dist: all
  40. rm -rf dist
  41. mkdir -p dist/$(SLUG)
  42. @# Strip and copy plugin binary
  43. cp $(TARGET) dist/$(SLUG)/
  44. ifdef ARCH_MAC
  45. $(STRIP) -S dist/$(SLUG)/$(TARGET)
  46. else
  47. $(STRIP) -s dist/$(SLUG)/$(TARGET)
  48. endif
  49. @# Copy distributables
  50. ifdef ARCH_MAC
  51. rsync -rR $(DISTRIBUTABLES) dist/$(SLUG)/
  52. else
  53. cp -r --parents $(DISTRIBUTABLES) dist/$(SLUG)/
  54. endif
  55. @# Create ZIP package
  56. cd dist && zip -q -9 -r $(SLUG)-$(VERSION)-$(ARCH).zip $(SLUG)
  57. install: dist
  58. cp dist/$(SLUG)-$(VERSION)-$(ARCH).zip $(RACK_USER_DIR)/plugins-v1/
  59. .PHONY: clean dist
  60. .DEFAULT_GOAL := all