GNUmakefile 1022 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Minimal Height Input
  2. #
  3. # Douglas Thrift
  4. #
  5. # GNUmakefile
  6. ifeq ($(OS),Windows_NT)
  7. SED := C:\cygwin\bin\sed.exe
  8. ZIP := C:\cygwin\bin\zip.exe
  9. PROFILE := $(subst /,\,$(firstword $(wildcard $(APPDATA)/Instantbird/Profiles/*.default)))
  10. RM_F := del /F /A
  11. else
  12. SED := sed
  13. ZIP := zip
  14. PROFILE := $(firstword $(wildcard ~/.instantbird/*.default))
  15. RM_F := rm -f
  16. endif
  17. files := install.rdf bootstrap.js
  18. id := $(firstword $(shell $(SED) -re "s|^.*<em:id>(.+)</em:id>.*$$|\1|p;d" install.rdf))
  19. version := $(shell $(SED) -re "s|^.*<em:version>(.+)</em:version>.*$$|\1|p;d" install.rdf)
  20. xpi := $(shell echo $(id) | $(SED) -re "s/^(.+)@.*$$/\1/")-$(version).xpi
  21. shortcut := $(PROFILE)/extensions/$(id)
  22. cwd := $(CURDIR)/
  23. ifeq ($(OS),Windows_NT)
  24. shortcut := $(subst /,\,$(shortcut))
  25. cwd := $(subst /,\,$(cwd))
  26. endif
  27. .PHONY: all install deinstall uninstall clean
  28. all: $(xpi)
  29. $(xpi): $(files)
  30. $(ZIP) -ll $(xpi) $(files)
  31. install:
  32. echo $(cwd)> $(shortcut)
  33. deinstall:
  34. -$(RM_F) $(shortcut)
  35. uninstall: deinstall
  36. clean:
  37. -$(RM_F) *.xpi