Advertisement
Guest User

Untitled

a guest
Nov 5th, 2011
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. # Variables
  2. #==============================================================
  3.  
  4. compileDir = compileDir/
  5. testDir = testDir/
  6. testSourceDir = testSrc/
  7. testStrDir = testStrDir/
  8. testStringSrc = testStringSrc/
  9. outputDir = output/
  10. sourceDir = src/
  11. test_files := $(wildcard $(testSourceDir)*.cpp)
  12. test_output := $(addprefix $(testDir),$(notdir $(test_files:.cpp=)))
  13.  
  14.  
  15. # NodeStack
  16. #==============================================================
  17.  
  18. msg:
  19. @echo 'Targets are:'
  20. @echo ' tests'
  21. @echo ' main'
  22. @echo ' infix_to_postfix'
  23. @echo ' clean'
  24.  
  25. #==============================================================
  26. # Run all tests
  27. # Add test programs as dependencies and
  28. # uncomment or add test program as command
  29. tests: assembler.o string.o $(test_output) $(test_stringOutput)
  30. @echo '--- Testing complete ---'
  31.  
  32. $(testDir)%: $(compileDir)%.o string.o
  33. g++ -o $@ $< $(compileDir)string.o $(compileDir)assembler.o
  34. $@
  35. @echo ''
  36.  
  37. $(compileDir)%.o: $(testSourceDir)%.cpp
  38. g++ -c -Wall -o $@ $<
  39.  
  40. $(compileDir)%.o: $(testStringSrc)%.cpp
  41. g++ -c -Wall -o $@ $<
  42.  
  43. #==============================================================
  44. # Build main
  45. main: $(sourceDir)string.h $(sourceDir)nodeStack.h $(sourceDir)assembler.h main.o string.o assembler.o
  46. g++ -o $(outputDir)main -Wall $(compileDir)string.o $(compileDir)main.o $(compilDir)assembler.o
  47. @echo ''
  48. @echo '--- Executing File ---'
  49. @echo ''
  50. $(outputDir)main
  51. @echo '--- End File Execution ---'
  52. @echo ''
  53.  
  54. main.o: $(sourceDir)main.cpp $(sourceDir)string.h $(sourceDir)nodeStack.h
  55. g++ -o $(compileDir)main.o -c -Wall $(sourceDir)main.cpp
  56.  
  57. #==============================================================
  58. # Build infix
  59. infix_to_postfix: $(sourceDir)string.h $(sourceDir)nodeStack.h $(sourceDir)assembler.h infix_to_postfix.o string.o assembler.o
  60. g++ -o $(outputDir)infix_to_postfix -Wall $(compileDir)string.o $(compileDir)infix_to_postfix.o $(compileDir)assembler.o
  61. @echo ''
  62. @echo '--- Executing File ---'
  63. @echo ''
  64. $(outputDir)infix_to_postfix
  65. @echo '--- End File Execution ---'
  66. @echo ''
  67.  
  68. infix_to_postfix.o: $(sourceDir)infix_to_postfix.cpp $(sourceDir)string.h $(sourceDir)nodeStack.h
  69. g++ -o $(compileDir)infix_to_postfix.o -c -Wall $(sourceDir)infix_to_postfix.cpp
  70.  
  71. #==============================================================
  72. # Build assembler
  73. assembler.o: $(sourceDir)string.o $(sourceDir)string.h $(sourceDir)assembler.h $(sourceDir)assembler.cpp
  74. g++ -o $(compileDir)assembler.o -c -Wall $(sourceDir)assembler.cpp
  75.  
  76. #==============================================================
  77. # Build string
  78. string.o: $(sourceDir)string.cpp $(sourceDir)string.h
  79. g++ -o $(compileDir)string.o -c -Wall $(sourceDir)string.cpp
  80.  
  81. #==============================================================
  82. # Build tests
  83. test_stack: $(sourceDir)string.h test_stack.o $(sourceDir)nodeStack.h
  84. g++ -o $(testDir)test_stack -Wall $(compileDir)string.o $(compileDir)test_stack.o
  85.  
  86. test_stack.o: $(testSourceDir)test_stack.cpp $(sourceDir)string.h $(sourceDir)nodeStack.h
  87. g++ -o $(compileDir)test_stack.o -c -Wall $(testSourceDir)test_stack.cpp
  88.  
  89. #==============================================================
  90. # Clean
  91. clean:
  92. rm -f ./$(compileDir)*
  93. rm -f ./$(outputDir)*
  94. rm -f ./$(testDir)*
  95.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement