aboutsummaryrefslogtreecommitdiff
path: root/counter/Makefile
blob: da512e5bbffda6386067afe717409708b3e2c971 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# SPDX-FileCopyrightText: 2023 Brian Woods
# SPDX-License-Identifier: GPL-2.0-or-later

# this is for ghdl-gcc, I've not tested it on ghdl-llvm but it will not
# work with ghdl-mcode

SRC=simulation.vhd top.vhd counter.vhd
OBJ=$(SRC:.vhd=.o)
TOP=simulation
TOP_OBJ=e~$(TOP).o
WAVE=simulation.ghw
WORKLIB=work
FLAGS=--std=08 --work=$(WORKLIB)
TIME=1us

.PHONY: all clean sim

all: $(TOP)

%.o: %.vhd
	ghdl -a $(FLAGS) $<

$(TOP): $(OBJ)
	ghdl -e $(FLAGS) $@

$(WAVE): $(TOP)
	ghdl -r $(FLAGS) $< --wave=$@ --stop-time=$(TIME)

sim: $(WAVE)
	 gtkwave $<

clean:
	rm -f $(OBJ) $(TOP_OBJ) $(TOP) $(WAVE) $(WORKLIB)-obj*.cf