1*8cfd11c3SMatthias Ringwald# Makefile to build and run tests of CMake project 2*8cfd11c3SMatthias Ringwald# TODO: replace list of hard-coded tests with CMake call to run all tests 3*8cfd11c3SMatthias Ringwald 4*8cfd11c3SMatthias Ringwald# Variables 5*8cfd11c3SMatthias RingwaldBUILD_DIR = build 6*8cfd11c3SMatthias RingwaldTARGET = all # Default build target 7*8cfd11c3SMatthias Ringwald 8*8cfd11c3SMatthias Ringwald# Default rule 9*8cfd11c3SMatthias Ringwaldall: configure build 10*8cfd11c3SMatthias Ringwald 11*8cfd11c3SMatthias Ringwald# Step 1: Configure CMake 12*8cfd11c3SMatthias Ringwaldconfigure: 13*8cfd11c3SMatthias Ringwald @echo "Configuring project in $(BUILD_DIR)..." 14*8cfd11c3SMatthias Ringwald @mkdir -p $(BUILD_DIR) 15*8cfd11c3SMatthias Ringwald @cd ${BUILD_DIR} && cmake .. 16*8cfd11c3SMatthias Ringwald 17*8cfd11c3SMatthias Ringwald# Step 2: Build the project 18*8cfd11c3SMatthias Ringwaldbuild: configure 19*8cfd11c3SMatthias Ringwald @echo "Building project in $(BUILD_DIR)..." 20*8cfd11c3SMatthias Ringwald @cmake --build $(BUILD_DIR) --target $(TARGET) 21*8cfd11c3SMatthias Ringwald 22*8cfd11c3SMatthias Ringwald# Step 3: Run the tests 23*8cfd11c3SMatthias Ringwaldtest: build 24*8cfd11c3SMatthias Ringwald @echo "Running tests..." 25*8cfd11c3SMatthias Ringwald $(BUILD_DIR)/btstack_util_test 26*8cfd11c3SMatthias Ringwald 27*8cfd11c3SMatthias Ringwald# Step 4: Clean the build 28*8cfd11c3SMatthias Ringwaldclean: 29*8cfd11c3SMatthias Ringwald @echo "Cleaning build directory..." 30*8cfd11c3SMatthias Ringwald @rm -rf $(BUILD_DIR) 31*8cfd11c3SMatthias Ringwald 32*8cfd11c3SMatthias Ringwald 33*8cfd11c3SMatthias Ringwald.PHONY: all configure build clean test 34