aboutsummaryrefslogblamecommitdiff
path: root/Makefile
blob: 3631e551312e2b721ed2bb018156c5076b7e71b2 (plain) (tree)
1
2
3
4
5
6
7




                                     

                                          







































                                                                                
                                        







                                                                                
export CC  = clang
export CXX = clang++

export SYSTEMC_HOME := $(PWD)/INSTALL

SRCS = $(wildcard src/*.cc)
BINS = $(SRCS:src/%.cc=BUILD/PLAYGROUND/%)

# -- SYSTEMC UTILS -------------------------------------------------------------

run: build
	@for B in $(BINS); do \
		echo "==> $$B"; \
		$$B; \
	done

build: INSTALL/lib/libsystemc.a BUILD/UTIL $(SRCS)
	ninja -C BUILD/UTIL

BUILD/UTIL: CMakeLists.txt
	cmake -B $@ -S . \
	      -G Ninja \
	      -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
	      -DCMAKE_BUILD_TYPE=DEBUG \
	      #-DCMAKE_FIND_DEBUG_MODE=ON
	#ninja -C $@ -t compdb > compile_commands.json

# -- SYSTEMC -------------------------------------------------------------------

INSTALL/lib/libsystemc.a: BUILD/SYSC
	ninja -C BUILD/SYSC install

BUILD/SYSC: systemc
	cmake -B $@ -S systemc \
	      -G Ninja \
	      -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
	      -DCMAKE_BUILD_TYPE=DEBUG \
	      -DCMAKE_INSTALL_PREFIX=$(PWD)/INSTALL \
	      -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 src/*.cc src/*.h

# -- CLEAN ---------------------------------------------------------------------

clean:
	$(RM) -r BUILD/UTIL compile_commands.json

distclean: clean
	$(RM) -r BUILD INSTALL systemc