GNUmakefile 1.2 KB

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