diff options
-rw-r--r-- | AK/Tests/Makefile | 117 |
1 files changed, 27 insertions, 90 deletions
diff --git a/AK/Tests/Makefile b/AK/Tests/Makefile index bd8ec67b83..13581e0758 100644 --- a/AK/Tests/Makefile +++ b/AK/Tests/Makefile @@ -1,98 +1,35 @@ -PROGRAMS = \ - TestBinarySearch \ - TestAtomic \ - TestString \ - TestQueue \ - TestVector \ - TestHashMap \ - TestJSON \ - TestWeakPtr \ - TestNonnullRefPtr \ - TestRefPtr \ - TestFixedArray \ - TestFileSystemPath \ - TestURL \ - TestStringView \ - TestUtf8 \ - TestCircularQueue +SHARED_TEST_SOURCES = \ + ../String.cpp \ + ../StringImpl.cpp \ + ../StringBuilder.cpp \ + ../StringView.cpp \ + ../LogStream.cpp \ + ../JsonValue.cpp \ + ../JsonParser.cpp \ + ../FileSystemPath.cpp \ + ../URL.cpp \ + ../Utf8View.cpp -CXXFLAGS = -std=c++17 -Wall -Wextra -ggdb3 -O2 -I../ -I../../ - -SHARED_TEST_OBJS = \ - ../String.o \ - ../StringImpl.o \ - ../StringBuilder.o \ - ../StringView.o \ - ../LogStream.o \ - ../JsonValue.o \ - ../JsonParser.o \ - ../FileSystemPath.o \ - ../URL.o \ - ../Utf8View.o \ - -%.o: %.cpp ../*.h - @echo "HOST_CXX $<"; $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ -c $< - -define execute-command -$(1) - -endef - -all: $(PROGRAMS) - $(foreach x,$(PROGRAMS),$(call execute-command,./$(x))) - -TestBinarySearch: TestBinarySearch.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestBinarySearch.o $(SHARED_TEST_OBJS) - -TestAtomic: TestAtomic.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestAtomic.o $(SHARED_TEST_OBJS) - -TestString: TestString.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestString.o $(SHARED_TEST_OBJS) - -TestQueue: TestQueue.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestQueue.o $(SHARED_TEST_OBJS) +SRCS = $(wildcard *.cpp) +SHARED_TEST_OBJS = ${SHARED_TEST_SOURCES:.cpp=.host.o} +OBJS = ${SRCS:.cpp=.host.o} $(SHARED_TEST_OBJS) +APPS = ${SRCS:.cpp=} -TestVector: TestVector.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestVector.o $(SHARED_TEST_OBJS) +EXTRA_CLEAN = $(APPS) *.o -TestFixedArray: TestFixedArray.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestFixedArray.o $(SHARED_TEST_OBJS) +HOST_CXX = 1 -TestHashMap: TestHashMap.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestHashMap.o $(SHARED_TEST_OBJS) +include ../../Makefile.common -TestJSON: TestJSON.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestJSON.o $(SHARED_TEST_OBJS) - -TestWeakPtr: TestWeakPtr.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestWeakPtr.o $(SHARED_TEST_OBJS) - -TestNonnullRefPtr: TestNonnullRefPtr.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestNonnullRefPtr.o $(SHARED_TEST_OBJS) - -TestRefPtr: TestRefPtr.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestRefPtr.o $(SHARED_TEST_OBJS) - -TestOptional: TestOptional.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestOptional.o $(SHARED_TEST_OBJS) - -TestFileSystemPath: TestFileSystemPath.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestFileSystemPath.o $(SHARED_TEST_OBJS) - -TestURL: TestURL.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestURL.o $(SHARED_TEST_OBJS) - -TestStringView: TestStringView.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestStringView.o $(SHARED_TEST_OBJS) - -TestUtf8: TestUtf8.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestUtf8.o $(SHARED_TEST_OBJS) +CXXFLAGS = -std=c++17 -Wall -Wextra -ggdb3 -O2 -I../ -I../../ -TestCircularQueue: TestCircularQueue.o $(SHARED_TEST_OBJS) - $(PRE_CXX) $(CXX) $(CXXFLAGS) -o $@ TestCircularQueue.o $(SHARED_TEST_OBJS) +APPS_RUN = $(addsuffix .run,$(APPS)) +test: $(APPS) $(APPS_RUN) +$(APPS_RUN): %.run: + ./$* +$(APPS): %: %$(OBJ_SUFFIX).o $(SHARED_TEST_OBJS) + @echo "LINK $@" + $(QUIET) $(CXX) -o $@ $< $(SHARED_TEST_OBJS) $(LDFLAGS) -clean: - rm -f $(SHARED_TEST_OBJS) - rm -f $(PROGRAMS) +all: | $(APPS) $(APPS_RUN) |