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.

74 lines
1.4KB

  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 $(RACK_DIR)/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. cp -R $(DISTRIBUTABLES) dist/$(SLUG)/
  51. @# Create ZIP package
  52. cd dist && zip -q -9 -r $(SLUG)-$(VERSION)-$(ARCH).zip $(SLUG)
  53. install: dist
  54. cp dist/$(SLUG)-$(VERSION)-$(ARCH).zip $(RACK_USER_DIR)/plugins/
  55. .PHONY: clean dist
  56. .DEFAULT_GOAL := all