Makefile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. all:
  2. ifndef CALCULATOR
  3. %: make89-% make9x-% makev2-%
  4. @# dummy command, otherwise make ignores the rule
  5. make89-%:
  6. $(MAKE) $(patsubst make89-%,%,$@) CALCULATOR=89
  7. make9x-%:
  8. $(MAKE) $(patsubst make9x-%,%,$@) CALCULATOR=9x
  9. makev2-%:
  10. $(MAKE) $(patsubst makev2-%,%,$@) CALCULATOR=v2
  11. else
  12. PRETTY_CALCULATOR=$(if $(subst 89,,$(CALCULATOR)),$(if $(subst 9x,,$(CALCULATOR)),v200,92p),89)
  13. DIR = bin-$(PRETTY_CALCULATOR)
  14. MK = mkinfo-$(PRETTY_CALCULATOR)-
  15. all: ide h pch flashapp
  16. ide: $(MK)ide
  17. h: $(MK)h
  18. pch: $(MK)pch
  19. flashapp: $(MK)flashapp
  20. clean:
  21. distclean: clean
  22. scratchclean: distclean
  23. $(RM) $(MK)*
  24. $(RM) -r $(DIR)
  25. $(MK)h : ../h/processed/*
  26. $(MK)pch : ../pch/*
  27. $(MK)h : filedir = ../h/processed
  28. $(MK)pch : filedir = ../pch
  29. $(MK)h : fileext = t
  30. $(MK)pch : fileext = y
  31. $(MK)h $(MK)pch: files = $(wildcard $(filedir)/*.89$(fileext))
  32. $(MK)h $(MK)pch:
  33. mkdir -p $(DIR)
  34. $(foreach file,$(files),cp $(file) $(patsubst $(filedir)/%.89$(fileext),$(DIR)/%.$(CALCULATOR)$(fileext),$(file));)
  35. touch $@
  36. $(MK)ide: ide/bin/*
  37. mkdir -p $(DIR)
  38. cp ide/bin/gtc-ide.$(CALCULATOR)z $(DIR)
  39. touch $@
  40. $(MK)flashapp: srcdata/flashapp/*
  41. $(MK)flashapp: tifs_calc = $(if $(subst 89,,$(CALCULATOR)),92p,89)
  42. $(MK)flashapp: tifs_ext = $(if $(subst 89,,$(CALCULATOR)),9xk,89k)
  43. $(MK)flashapp:
  44. mkdir -p $(DIR)
  45. cp srcdata/flashapp/gtc-$(tifs_calc).$(tifs_ext) $(DIR)/gtc.$(CALCULATOR)k
  46. touch $@
  47. endif