scsl/Makefile

48 lines
937 B
Makefile
Raw Normal View History

2023-10-06 03:13:46 +00:00
TARGET := klib.a
2023-10-06 06:17:09 +00:00
TESTS := tlv_test dictionary_test
2023-10-06 03:13:46 +00:00
HEADERS := $(wildcard *.h)
SOURCES := $(wildcard *.cc)
2023-10-06 06:17:09 +00:00
OBJS := Arena.o Dictionary.o TLV.o
2023-10-06 03:13:46 +00:00
CXX := clang++
2023-10-15 01:38:01 +00:00
CXXFLAGS := -g -std=c++14 -Werror -Wall -DSCSL_DESKTOP_BUILD
2023-10-06 03:13:46 +00:00
.PHONY: all
all: $(TARGET) $(TESTS) tags run-tests
tags: $(HEADERS) $(SOURCES)
ctags $(HEADERS) $(SOURCES)
$(TARGET): $(OBJS)
$(AR) rcs $@ $(OBJS)
2023-10-06 06:17:09 +00:00
tlv_test: tlvTest.o $(TARGET)
$(CXX) -o $@ $(CXXFLAGS) tlvTest.o $(TARGET)
2023-10-06 03:13:46 +00:00
2023-10-06 06:17:09 +00:00
dictionary_test: dictionaryTest.o $(TARGET)
$(CXX) -o $@ $(CXXFLAGS) dictionaryTest.o $(TARGET)
2023-10-06 04:18:21 +00:00
2023-10-06 03:13:46 +00:00
.PHONY: print-%
print-%: ; @echo '$(subst ','\'',$*=$($*))'
klib.a: $(OBJS)
%.o: %.cc
$(CXX) -o $@ -c $(CXXFLAGS) $<
.PHONY: clean
clean:
# build outputs
rm -f $(TARGET) $(TESTS) *.o
# test miscellaneous
rm -f core core.* tags arena_test.bin
.PHONY: run-tests
run-tests: $(TESTS)
for testbin in $(TESTS); \
do \
echo "./$${testbin}" ; \
./$${testbin}; \
done