forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure the makefile a little so it only builds objects once, and then run them on make clean. This is a little slower (since we're relinking tests each makeall), but it also ensures that it will work.
- Loading branch information
1 parent
3b588b7
commit a321365
Showing
2 changed files
with
37 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,47 @@ | ||
PROGRAMS = TestString TestQueue TestVector TestHashMap TestJSON TestWeakPtr | ||
|
||
all: $(PROGRAMS) | ||
CXXFLAGS = -std=c++17 -Wall -Wextra -ggdb3 -O2 -I../ -I../../ | ||
|
||
SHARED_TEST_OBJS = \ | ||
../String.o \ | ||
../StringImpl.o \ | ||
../StringBuilder.o \ | ||
../StringView.o \ | ||
../LogStream.o \ | ||
../JsonArray.o \ | ||
../JsonObject.o \ | ||
../JsonValue.o \ | ||
../JsonParser.o \ | ||
|
||
CXXFLAGS = -std=c++17 -Wall -Wextra -ggdb3 -O2 | ||
.cpp.o: | ||
@echo "HOST_CXX $<"; $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ -c $< | ||
|
||
TestString: TestString.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../TestSuite.h ../LogStream.cpp | ||
$(CXX) $(CXXFLAGS) -I../ -I../../ -o $@ TestString.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../LogStream.cpp | ||
define execute-command | ||
$(1) | ||
|
||
TestQueue: TestQueue.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../TestSuite.h ../LogStream.cpp | ||
$(CXX) $(CXXFLAGS) -I../ -I../../ -o $@ TestQueue.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../LogStream.cpp | ||
endef | ||
|
||
all: $(PROGRAMS) | ||
$(foreach x,$(PROGRAMS),$(call execute-command,./$(x))) | ||
|
||
TestVector: TestVector.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../TestSuite.h ../LogStream.cpp | ||
$(CXX) $(CXXFLAGS) -I../ -I../../ -o $@ TestVector.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../LogStream.cpp | ||
TestString: TestString.o $(SHARED_TEST_OBJS) | ||
$(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestString.o $(SHARED_TEST_OBJS) | ||
|
||
TestHashMap: TestHashMap.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../TestSuite.h ../LogStream.cpp | ||
$(CXX) $(CXXFLAGS) -I../ -I../../ -o $@ TestHashMap.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../LogStream.cpp | ||
TestQueue: TestQueue.o $(SHARED_TEST_OBJS) | ||
$(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestQueue.o $(SHARED_TEST_OBJS) | ||
|
||
TestJSON: TestJSON.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../TestSuite.h ../LogStream.cpp ../JsonObject.cpp ../JsonValue.cpp ../JsonArray.cpp ../JsonParser.cpp | ||
$(CXX) $(CXXFLAGS) -I../ -I../../ -o $@ TestJSON.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../LogStream.cpp ../JsonObject.cpp ../JsonValue.cpp ../JsonArray.cpp ../JsonParser.cpp | ||
TestVector: TestVector.o $(SHARED_TEST_OBJS) | ||
$(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestVector.o $(SHARED_TEST_OBJS) | ||
# | ||
TestHashMap: TestHashMap.o $(SHARED_TEST_OBJS) | ||
$(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestHashMap.o $(SHARED_TEST_OBJS) | ||
# | ||
TestJSON: TestJSON.o $(SHARED_TEST_OBJS) | ||
$(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestJSON.o $(SHARED_TEST_OBJS) | ||
|
||
TestWeakPtr: TestWeakPtr.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../TestSuite.h ../LogStream.cpp ../WeakPtr.h ../Weakable.h | ||
$(CXX) $(CXXFLAGS) -I../ -I../../ -o $@ TestWeakPtr.cpp ../String.cpp ../StringImpl.cpp ../StringBuilder.cpp ../StringView.cpp ../LogStream.cpp | ||
TestWeakPtr: TestWeakPtr.o $(SHARED_TEST_OBJS) | ||
$(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestWeakPtr.o $(SHARED_TEST_OBJS) | ||
|
||
clean: | ||
rm -f $(SHARED_TEST_OBJS) | ||
rm -f $(PROGRAMS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters