aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-05-26 11:17:50 +0200
committerClifford Wolf <clifford@clifford.at>2018-05-26 11:17:50 +0200
commit1338f0f9ebc1748d93ac331d277f2fd0c2cb30b4 (patch)
tree136b7027c50a13baa26936810605e4706273e9d6 /Makefile
parent5e48758b30caf8ecc91c3c416326a093b47a2e2d (diff)
downloadnextpnr-1338f0f9ebc1748d93ac331d277f2fd0c2cb30b4.tar.gz
nextpnr-1338f0f9ebc1748d93ac331d277f2fd0c2cb30b4.tar.bz2
nextpnr-1338f0f9ebc1748d93ac331d277f2fd0c2cb30b4.zip
Add Makefile
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 30 insertions, 0 deletions
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