From 1338f0f9ebc1748d93ac331d277f2fd0c2cb30b4 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sat, 26 May 2018 11:17:50 +0200 Subject: Add Makefile Signed-off-by: Clifford Wolf --- Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..2ddcb724 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +archs = dummy +common_objs = design.o +dummy_objs = chip.o main.o + +CXX = clang +CXXFLAGS = -ggdb -MD -std=c++11 -O2 -Icommon +LDFLAGS = -ggdb +LDLIBS = -lstdc++ + +define binaries +all:: nextpnr-$(1) + +nextpnr-$(1): $$(addprefix build/$(1)-common-,$$(common_objs)) $$(addprefix build/$(1)-arch-,$$($(1)_objs)) + $$(CXX) -o $$@ $$(LDFLAGS) -I$(1) $$^ $$(LDLIBS) + +build/$(1)-common-%.o: common/%.cc + @mkdir -p build + $$(CXX) -c -o $$@ -D$$(shell echo arch_$(1) | tr a-z A-Z) $$(CXXFLAGS) -I$(1) $$< + +build/$(1)-arch-%.o: $(1)/%.cc + @mkdir -p build + $$(CXX) -c -o $$@ -D$$(shell echo arch_$(1) | tr a-z A-Z) $$(CXXFLAGS) -I$(1) $$< +endef + +$(foreach arch,$(archs),$(eval $(call binaries,$(arch)))) + +clean: + rm -rf $(addprefix nextpnr-,$(archs)) build + +-include build/*.d -- cgit v1.2.3