Makefile 900 B

1234567891011121314151617181920212223242526272829303132
  1. CXX ?= g++
  2. CXXFLAGS ?= -std=c++11 -g -O0 -Wall -pthread
  3. GENDIR ?= ../../include_v2.0
  4. GTESTSRC ?= /usr/src/gtest/src/gtest-all.cc
  5. MSGDEFDIR ?= ../../../../../message_definitions/v1.0
  6. DIALECTS := $(notdir $(shell find $(GENDIR) -mindepth 1 -maxdepth 1 -type d))
  7. TARGETS := $(foreach d,$(DIALECTS),mavtest_$(d))
  8. all: run_tests
  9. gtest-all.o: $(GTESTSRC)
  10. $(CXX) $(CXXFLAGS) -I"$(dir $(GTESTSRC))../" -c -o $@ $<
  11. mavtest_%: mtest.cpp gtest-all.o $(foreach d,$(DIALECTS),$(GENDIR)/$(d)/$(d).hpp)
  12. $(CXX) $(CXXFLAGS) -I $(GENDIR)/$* -o $@ $< gtest-all.o
  13. run_tests: $(TARGETS)
  14. for f in $(TARGETS); do \
  15. ./$$f; \
  16. done
  17. gen: $(wildcard $(MSGDEFDIR)/*.xml)
  18. mkdir -p $(GENDIR)
  19. for d in $^; do \
  20. ../../../../tools/mavgen.py -o $(GENDIR) --wire-protocol 2.0 --lang C $$d; \
  21. ../../../../tools/mavgen.py -o $(GENDIR) --wire-protocol 2.0 --lang C++11 $$d; \
  22. done
  23. clean:
  24. rm -f gtest-all.o $(TARGETS)