Systemnähes Programmierung: compiler
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.
 
 
 

120 lines
2.7 KiB

  1. #
  2. # baut das komplette Scanner Projekt
  3. #
  4. AUTOMATDIR = Automat
  5. BUFFERDIR = Buffer
  6. SYMBOLTABLEDIR = Symboltable
  7. SCANNERDIR = Scanner
  8. PARSERDIR = Parser
  9. SHAREDLIB = sharedlib
  10. INCLUDES = includes
  11. all: empty-dirs automatLib bufferLib symboltableLib scanner
  12. @echo "target all"
  13. run:
  14. @echo "Running ScannerTest\n\n=====BEGIN====="
  15. LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:sharedlib Scanner/debug/ScannerTest testfiles/Scanner/testFile
  16. @echo "=====END====="
  17. clean:
  18. rm -rf $(AUTOMATDIR)/lib/*
  19. rm -rf $(BUFFERDIR)/lib/*
  20. rm -rf $(SYMBOLTABLEDIR)/lib/*
  21. rm -rf $(SHAREDLIB)/*
  22. rm -rf $(SCANNERDIR)/debug/*
  23. rm -rf $(AUTOMATDIR)/debug/*
  24. rm -rf $(BUFFERDIR)/debug/*
  25. rm -rf $(SYMBOLTABLEDIR)/debug/*
  26. empty-dirs:
  27. test -d $(AUTOMATDIR)/lib || mkdir $(AUTOMATDIR)/lib
  28. test -d $(AUTOMATDIR)/debug || mkdir $(AUTOMATDIR)/debug
  29. test -d $(BUFFERDIR)/lib || mkdir $(BUFFERDIR)/lib
  30. test -d $(BUFFERDIR)/debug || mkdir $(BUFFERDIR)/debug
  31. test -d $(SYMBOLTABLEDIR)/lib || mkdir $(SYMBOLTABLEDIR)/lib
  32. test -d $(SYMBOLTABLEDIR)/debug || mkdir $(SYMBOLTABLEDIR)/debug
  33. test -d $(SCANNERDIR)/lib || mkdir $(SCANNERDIR)/lib
  34. test -d $(SCANNERDIR)/debug || mkdir $(SCANNERDIR)/debug
  35. test -d $(SCANNERDIR)/lib || mkdir $(SCANNERDIR)/lib
  36. test -d $(SHAREDLIB) || mkdir $(SHAREDLIB)
  37. parser:
  38. $(MAKE) -C $(PARSERDIR) parser
  39. scanner:
  40. $(MAKE) -C $(SCANNERDIR) makeTestScanner
  41. automatLib:
  42. $(MAKE) -C $(AUTOMATDIR) AutomatLib
  43. bufferLib:
  44. $(MAKE) -C $(BUFFERDIR) BufferLib
  45. # scannerLib wird erst fuer den Parser Teil benoetigt
  46. #scannerLib:
  47. #$(MAKE) -C $(SCANNERDIR) ScannerLib
  48. symboltableLib:
  49. $(MAKE) -C $(SYMBOLTABLEDIR) SymboltableLib
  50. # stand-alone compiling and testing of some modules
  51. testAutomat:
  52. $(MAKE) -C $(AUTOMATDIR) makeTestAutomat
  53. testBuffer:
  54. $(MAKE) -C $(BUFFERDIR) makeTestBuffer
  55. testSymtab:
  56. $(MAKE) -C $(SYMBOLTABLEDIR) makeTestSymboltable
  57. runTestAutomat:
  58. @echo "Running runTestAutomat\n\n=====BEGIN====="
  59. Automat/debug/AutomatTest
  60. @echo "=====END====="
  61. runTestBuffer:
  62. @echo "Running runTestBuffer\n\n=====BEGIN====="
  63. Buffer/debug/BufferTest testfiles/Scanner/testFile
  64. @echo "=====END====="
  65. runTestSymtab:
  66. @echo "Running runTestSymtab\n\n=====BEGIN====="
  67. Symboltable/debug/SymboltableTest
  68. @echo "=====END====="
  69. # compile object files
  70. automatObj:
  71. $(MAKE) -C $(AUTOMATDIR) AutomatLibTarget
  72. bufferObj:
  73. $(MAKE) -C $(BUFFERDIR) BufferLibTarget
  74. symboltableObj:
  75. $(MAKE) -C $(SYMBOLTABLEDIR) SymboltableLibTarget
  76. scannerObj:
  77. $(MAKE) -C $(SCANNERDIR) ScannerLibTarget
  78. # build the scannerLib
  79. scannerLib: empty-dirs automatObj bufferObj symboltableObj scannerObj
  80. g++ -shared -o $(SHAREDLIB)/libScanner.so \
  81. $(AUTOMATDIR)/lib/Automat.o \
  82. $(BUFFERDIR)/lib/Buffer.o \
  83. $(SYMBOLTABLEDIR)/lib/Symboltable.o \
  84. $(SCANNERDIR)/lib/Scanner.o \
  85. $(SCANNERDIR)/lib/Token.o