blob: 360a8b9373fcdc642b480f4ea9169d5bccd4ff18 (
plain) (
tree)
|
|
export CC = clang
export CXX = clang++
export SYSTEMC_HOME := $(PWD)/INSTALL
V ?= 0
ifeq ($V,1)
NINJA_FLAGS += --verbose
CCTEST_FLAGS += --verbose
endif
SRCS = $(shell find src test -type f -name \*.h -or -name \*.cc)
BINS = $(SRCS:src/%.cc=BUILD/PLAYGROUND/%)
# -- SYSTEMC PLAYGROUND --------------------------------------------------------
build: $(SYSTEMC_HOME)/lib/libsystemc.a BUILD/PLAYGROUND/CMakeCache.txt $(SRCS)
ninja -C BUILD/PLAYGROUND $(NINJA_FLAGS)
run: build
@for B in $(BINS); do \
echo "==> $$B"; \
$$B; \
done
run/%: $(SYSTEMC_HOME)/lib/libsystemc.a BUILD/PLAYGROUND/CMakeCache.txt src/%.cc
ninja -C BUILD/PLAYGROUND $(NINJA_FLAGS) $*
BUILD/PLAYGROUND/$*
test: build
cd BUILD/PLAYGROUND/test && ctest --output-on-failure $(CCTEST_FLAGS)
BUILD/PLAYGROUND/CMakeCache.txt: CMakeLists.txt
cmake -B BUILD/PLAYGROUND $@ -S . \
-G Ninja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_BUILD_TYPE=DEBUG \
#-DCMAKE_FIND_DEBUG_MODE=ON
ln -sfn BUILD/PLAYGROUND/compile_commands.json
#ninja -C $@ -t compdb > compile_commands.json
# -- SYSTEMC -------------------------------------------------------------------
$(SYSTEMC_HOME)/lib/libsystemc.a: BUILD/SYSC/CMakeCache.txt
ninja -C BUILD/SYSC install $(NINJA_FLAGS)
BUILD/SYSC/CMakeCache.txt: systemc
cmake -B BUILD/SYSC -S systemc \
-G Ninja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_BUILD_TYPE=DEBUG \
-DCMAKE_INSTALL_PREFIX=$(SYSTEMC_HOME) \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CXX_STANDARD=14
systemc:
git clone --depth=1 https://github.com/accellera-official/systemc.git
# -- UTIL ----------------------------------------------------------------------
fmt:
clang-format -i $(shell find src test -type f -name \*.h -or -name \*.cc)
# -- CLEAN ---------------------------------------------------------------------
clean:
$(RM) -r BUILD/PLAYGROUND compile_commands.json
distclean: clean
$(RM) -r BUILD $(SYSTEMC_HOME) systemc
|