Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Variables
- #==============================================================
- compileDir = compileDir/
- testDir = testDir/
- testSourceDir = testSrc/
- testStrDir = testStrDir/
- testStringSrc = testStringSrc/
- outputDir = output/
- sourceDir = src/
- test_files := $(wildcard $(testSourceDir)*.cpp)
- test_output := $(addprefix $(testDir),$(notdir $(test_files:.cpp=)))
- # NodeStack
- #==============================================================
- msg:
- @echo 'Targets are:'
- @echo ' tests'
- @echo ' main'
- @echo ' infix_to_postfix'
- @echo ' clean'
- #==============================================================
- # Run all tests
- # Add test programs as dependencies and
- # uncomment or add test program as command
- tests: assembler.o string.o $(test_output) $(test_stringOutput)
- @echo '--- Testing complete ---'
- $(testDir)%: $(compileDir)%.o string.o
- g++ -o $@ $< $(compileDir)string.o $(compileDir)assembler.o
- $@
- @echo ''
- $(compileDir)%.o: $(testSourceDir)%.cpp
- g++ -c -Wall -o $@ $<
- $(compileDir)%.o: $(testStringSrc)%.cpp
- g++ -c -Wall -o $@ $<
- #==============================================================
- # Build main
- main: $(sourceDir)string.h $(sourceDir)nodeStack.h $(sourceDir)assembler.h main.o string.o assembler.o
- g++ -o $(outputDir)main -Wall $(compileDir)string.o $(compileDir)main.o $(compilDir)assembler.o
- @echo ''
- @echo '--- Executing File ---'
- @echo ''
- $(outputDir)main
- @echo '--- End File Execution ---'
- @echo ''
- main.o: $(sourceDir)main.cpp $(sourceDir)string.h $(sourceDir)nodeStack.h
- g++ -o $(compileDir)main.o -c -Wall $(sourceDir)main.cpp
- #==============================================================
- # Build infix
- infix_to_postfix: $(sourceDir)string.h $(sourceDir)nodeStack.h $(sourceDir)assembler.h infix_to_postfix.o string.o assembler.o
- g++ -o $(outputDir)infix_to_postfix -Wall $(compileDir)string.o $(compileDir)infix_to_postfix.o $(compileDir)assembler.o
- @echo ''
- @echo '--- Executing File ---'
- @echo ''
- $(outputDir)infix_to_postfix
- @echo '--- End File Execution ---'
- @echo ''
- infix_to_postfix.o: $(sourceDir)infix_to_postfix.cpp $(sourceDir)string.h $(sourceDir)nodeStack.h
- g++ -o $(compileDir)infix_to_postfix.o -c -Wall $(sourceDir)infix_to_postfix.cpp
- #==============================================================
- # Build assembler
- assembler.o: $(sourceDir)string.o $(sourceDir)string.h $(sourceDir)assembler.h $(sourceDir)assembler.cpp
- g++ -o $(compileDir)assembler.o -c -Wall $(sourceDir)assembler.cpp
- #==============================================================
- # Build string
- string.o: $(sourceDir)string.cpp $(sourceDir)string.h
- g++ -o $(compileDir)string.o -c -Wall $(sourceDir)string.cpp
- #==============================================================
- # Build tests
- test_stack: $(sourceDir)string.h test_stack.o $(sourceDir)nodeStack.h
- g++ -o $(testDir)test_stack -Wall $(compileDir)string.o $(compileDir)test_stack.o
- test_stack.o: $(testSourceDir)test_stack.cpp $(sourceDir)string.h $(sourceDir)nodeStack.h
- g++ -o $(compileDir)test_stack.o -c -Wall $(testSourceDir)test_stack.cpp
- #==============================================================
- # Clean
- clean:
- rm -f ./$(compileDir)*
- rm -f ./$(outputDir)*
- rm -f ./$(testDir)*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement