Compile the example tests with both a C and C++ compiler

This commit is contained in:
Andrew Eckel 2020-09-16 22:06:53 -04:00
parent f8a83d694b
commit 78a37432bd
2 changed files with 16 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.o
tags
test
test++

View File

@ -2,17 +2,26 @@ UNAME=$(shell uname)
CCFLAGS=-Wall -Wextra -Wconversion -Wredundant-decls -Wshadow -Wno-unused-parameter -O3
CC=clang
CXX=clang++
all: test
all: test test++
remake: clean all
%.o: %.c ctest.h
%.cpp: %.c
ln -fs $< $@
%.c.o: %.c ctest.h
$(CC) $(CCFLAGS) -c -o $@ $<
test: main.o ctest.h mytests.o
$(CC) $(LDFLAGS) main.o mytests.o -o test
%.cpp.o: %.cpp ctest.h
$(CXX) $(CCFLAGS) -c -o $@ $<
test: main.c.o ctest.h mytests.c.o
$(CC) $(LDFLAGS) main.c.o mytests.c.o -o test
test++: main.cpp.o ctest.h mytests.cpp.o
$(CXX) $(LDFLAGS) main.cpp.o mytests.cpp.o -o test++
clean:
rm -f test *.o
rm -f test test++ *.o