I am taking a C ++ course in college and they want us to manually enter all the test files ... I know, however, that there is a way to do this without since I ended up with the current one ( http://pastebin.com/ 6d9UtKM4 ) makefile. My question is: why does this makefile automatically delete all the .o files it uses to compile when this is done? This does not kill me, but I would like to save the .o files. I pasted the makefile here ( http://pastebin.com/6d9UtKM4 ). I also inserted the current result of running "make tests" here ( http://pastebin.com/h3Ny3dib ). (Note the portion at the bottom of this page that automatically deletes all .o files).
I would also like to get it to generate it as follows:
- g ++ -o compileDir / assembler.o -c -Wall src / assemblyler.cpp
- g ++ -o compileDir / string.o -c -Wall src / string.cpp
- g ++ -c -Wall -o compileDir / test_assignment.o testSrc / test_assignment.cpp
- g ++ -o testDir / test_assignment compileDir / test_assignment.o compilation Dir / string.o compilation Dir / assembler.o
- g ++ -c -Wall -o compileDir / test_bracket.o testSrc / test_bracket.cpp
- g ++ -o testDir / test_bracket compileDir / test_bracket.o compilation Dir / string.o compilation Dir / assembler .o
- testDir / test_bracket
- testDir / test_assignment
In other words, I want him to compile everything and then run everything. Hope this is not too much to ask!
Edit: Additional information: (This is the code that runs the "tests")
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 $@ $<
EDIT: -----------------------------------------
Solved through comments:
Adding this line is fixed: .PRECIOUS $ (compileDir)%. O
teynon
source share