fx9860g and fxcg50 2D math rendering library with support for TeX syntax.
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.

Makefile 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #! /usr/bin/make -f
  2. # Require the configuration file if we're not cleaning
  3. ifeq "$(filter clean distclean,$(MAKECMDGOALS))" ""
  4. ifeq ($(wildcard Makefile.cfg),)
  5. $(error "Makefile.cfg is missing. Did you ./configure ?")
  6. endif
  7. endif
  8. include Makefile.cfg
  9. include config/$(PLATFORM).cfg
  10. parser := src/TeX.y
  11. src := $(wildcard src/*.c) $(wildcard src/platform/$(PLATFORM).c)
  12. obj := $(src:src/%.c=build/%.c.o) $(parser:src/%.y=build/%.tab.c.o)
  13. cflags := -Wall -Wextra -std=c11 -I include -D_GNU_SOURCE $(CFLAGS)
  14. dflags = -MMD -MT $@ -MF $(@:.o=.d) -MP
  15. bflags := -L C
  16. #
  17. # Building
  18. #
  19. all: $(TARGET)
  20. TeX-SDL TeX-cli: $(obj)
  21. $(CC) $^ -o $@ $(cflags) $(LDFLAGS)
  22. libTeX-fx.a libTeX-cg.a: $(obj)
  23. $(AR) rcs $@ $^
  24. build/%.c.o: src/%.c Makefile.cfg
  25. @ mkdir -p $(dir $@)
  26. $(CC) -c $< -o $@ $(dflags) $(cflags)
  27. build/%.tab.c.o: build/%.tab.c
  28. @ mkdir -p $(dir $@)
  29. $(CC) -c $< -o $@ $(dflags) $(cflags)
  30. build/%.tab.c: src/%.y Makefile.cfg
  31. @ mkdir -p $(dir $@)
  32. bison $< -o $@ $(bflags)
  33. #
  34. # Dependency management
  35. #
  36. .PRECIOUS: build/%.tab.c
  37. .PRECIOUS: build/%.d
  38. build/%.d: ;
  39. include $(wildcard build/*.d)
  40. #
  41. # Install
  42. #
  43. ifeq "$(PLATFORM)" "fx9860g"
  44. install: $(TARGET)
  45. install -d $(PREFIX)
  46. install $(TARGET) -m 644 $(PREFIX)
  47. cp -r include/TeX $(PREFIX)/include
  48. uninstall: $(TARGET)
  49. rm -f $(PREFIX)/$(TARGET)
  50. rm -rf $(PREFIX)/include/TeX
  51. endif
  52. ifeq "$(PLATFORM)" "fxcg50"
  53. install: $(TARGET)
  54. install -d $(PREFIX)
  55. install $(TARGET) -m 644 $(PREFIX)
  56. cp -r include/TeX $(PREFIX)/include
  57. uninstall: $(TARGET)
  58. rm -f $(PREFIX)/$(TARGET)
  59. rm -rf $(PREFIX)/include/TeX
  60. endif
  61. #
  62. # Cleaning
  63. #
  64. clean:
  65. rm -rf build
  66. distclean: clean
  67. rm -f Makefile.cfg
  68. rm -f TeX-cli TeX-SDL libTeX-fx.a libTeX-cg.a
  69. .PHONY: all clean distclean install
  70. .SUFFIXES: