#Generated by Edalize
ifndef MODEL_TECH
$(error Environment variable MODEL_TECH was not found. It should be set to <modelsim install path>/bin)
endif

CC ?= gcc
CFLAGS := -c -std=c99 -fPIC -fno-stack-protector -g -m32

LD ?= ld
LDFLAGS := -shared -E -melf_i386

RM ?= rm
INCS := -I$(MODEL_TECH)/../include

VSIM ?= $(MODEL_TECH)/vsim

TOPLEVEL      := top_module
VPI_MODULES   := 
PARAMETERS    ?= vlogparam_bool=1 vlogparam_int=42 vlogparam_str=hello
PLUSARGS      ?= plusarg_bool=1 plusarg_int=42 plusarg_str=hello
VSIM_OPTIONS  ?= a few vsim_options
EXTRA_OPTIONS ?= $(VSIM_OPTIONS) $(addprefix -g,$(PARAMETERS)) $(addprefix +,$(PLUSARGS))

all: work $(VPI_MODULES)

run: work $(VPI_MODULES)
	$(VSIM) -do "run -all" -c $(addprefix -pli ,$(VPI_MODULES)) $(TOPLEVEL) $(EXTRA_OPTIONS)

run-gui: work $(VPI_MODULES)
	$(VSIM) -gui $(addprefix -pli ,$(VPI_MODULES)) $(TOPLEVEL) $(EXTRA_OPTIONS)

work:
	$(VSIM) -c -do "do edalize_main.tcl; exit"

clean: 
