summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile46
1 files changed, 19 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 75df413..5247017 100644
--- a/Makefile
+++ b/Makefile
@@ -1,24 +1,20 @@
PROJECTNAME=minicc
-CXX=clang++-10
-#CXX=g++-9
+CXX=clang++-11
+#CXX=g++-10
-#CXXFLAGS=-O2 -DNDEBUG
-CXXFLAGS=-O0 -g -D_DEBUG
+CXXFLAGS=-O2 -DNDEBUG
+#CXXFLAGS=-O0 -g -D_DEBUG
# -fprofile-instr-generate -fcoverage-mapping
# gcc:--coverage
-CXXFLAGS+= -Wall -I.
+CXXFLAGS+= -Wall -I. -std=c++20
-ifeq ($(CXX),clang++-10)
-# broken with lld-8:
-# ld.lld-8: error: undefined symbol: boost::re_detail_106700::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const
-CXXFLAGS+=-std=c++20 -stdlib=libc++
-else
-CXXFLAGS+=-std=c++2a
+ifeq ($(CXX),clang++-11)
+CXXFLAGS+=-stdlib=libc++
endif
-CXXTESTFLAGS=-Igoogletest/include -Igooglemock/include/ -Igoogletest -Igooglemock
+CXXTESTFLAGS+=-Igoogletest/include -Igooglemock/include/ -Igoogletest -Igooglemock
LIBS=\
-lboost_context \
@@ -30,9 +26,9 @@ LIBS=\
-lboost_regex \
-lpthread
-ifeq ($(CXX),clang++-10)
+ifeq ($(CXX),clang++-11)
LIBS+= \
--fuse-ld=lld-10 \
+-fuse-ld=lld-11 \
-lc++ \
-lc++abi
#-lc++fs
@@ -98,6 +94,7 @@ PROGSRC=\
programopts.cpp
TESTSRC=\
+ tests/test-asm.cpp \
tests/test-cpp.cpp \
tests/test-cppbnf.cpp \
tests/test-elf.cpp \
@@ -105,7 +102,6 @@ TESTSRC=\
tests/test-grammer.cpp \
tests/test-lexer.cpp \
tests/test-minicc.cpp \
- tests/test-asm.cpp \
googlemock/src/gmock-all.cpp \
googletest/src/gtest-all.cpp \
$(PROGSRC)
@@ -116,26 +112,24 @@ all: mcc
test: unittest systemtest
+check: test
+
# Tests on C++ level
unittest: test-$(PROJECTNAME)
./test-$(PROJECTNAME) #--gtest_filter='CppTest.compile_parentheses_right'
# Testing mcc executable and compiled elf programs
systemtest: mcc
- ./mcc systemtest/mcc-execute.tests/test-return-1.cpp
- ./mcc systemtest/mcc-execute.tests/test-addition.cpp
runtest --srcdir systemtest --tool mcc # --all
# testsuite ----------------------------------------------
-test-$(PROJECTNAME): $(TESTSRC:.cpp=.o)
- $(CXX) $(CXXFLAGS) $^ $(LIBS) -o $@
+test-$(PROJECTNAME): dep $(TESTSRC:.cpp=.o)
+ $(CXX) $(CXXFLAGS) $(TESTSRC:.cpp=.o) $(LIBS) -o $@
-mcc: $(SRC:.cpp=.o)
- $(CXX) $(CXXFLAGS) $^ $(LIBS) -o $@
+mcc: dep $(SRC:.cpp=.o)
+ $(CXX) $(CXXFLAGS) $(SRC:.cpp=.o) $(LIBS) -o $@
-dep:
- -rm -f $(TESTSRC:.cpp=.d) mcc.d
- $(MAKE) $(TESTSRC:.cpp=.d) mcc.d
+dep: $(TESTSRC:.cpp=.d) mcc.d
%.d: %.cpp
$(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -MM -MP -MF $@ -MT $(*D)/$(*F).o -c $<
@@ -154,8 +148,6 @@ ADD_DEP=Makefile
clean:
-rm -f test-$(PROJECTNAME) mcc tempfile.txt
-find . -name '*.o' -o -name '*.d' -o -name '*.gcno' -o -name '*.gcda' | xargs rm -f
- -rm -f systemtest/mcc-execute.tests/test-return-1
- -rm -f systemtest/mcc-execute.tests/test-addition
-rm -f *.log *.sum
zip: clean
@@ -163,6 +155,6 @@ zip: clean
zip -r ../$(PROJECTNAME).zip *
ls -l ../$(PROJECTNAME).zip
-.PHONY: clean all zip dep systemtest unittest
+.PHONY: clean all zip dep test check systemtest unittest
-include $(wildcard $(SRC:.cpp=.d))