POPCORN=popcorn.exe
ASSEMBLER = --TALC

LIBFILES = core

ifdef WINDIR
O=obj
A=lib
else
O=o
A=a
endif

POPFLAGS = $(ASSEMBLER) $(addprefix $(POPLIB), $(addsuffix .$(O), $(LIBFILES)))

EXES = rsa-cg.exe rsa-nocg.exe rsa-gcc.exe # rsa.exe 

compile: $(EXES)

rsa-gcc.exe: rsa-gcc.c
	gcc -O3 -o $@ $^

rsa-nocg.exe: rsa-nocg.pop
	$(POPCORN) -o $@ $(POPFLAGS) $^

rsa-cg.exe: rsa-cg.pop
	$(POPCORN) -o $@ $(POPFLAGS) $^

#rsa.exe: rsa.pop
#	$(POPCORN) -o $@ $(POPFLAGS) $^

rsabench: rsa-cg.exe rsa-nocg.exe rsa-gcc.exe
	@echo
	@echo RSA without run time code generation
	./rsa-nocg.exe
	@echo
	@echo RSA with run time code generation
	./rsa-cg.exe
	@echo
	@echo RSA with gcc -O3
	./rsa-gcc.exe

bench: rsabench


exe_only:
	rm -f *~ *.obj *.tal* *.lst

clean: exe_only
	rm -f *.exe
	rm -f *.ver
	rm -f *.pdb # produced by debugging
	rm -f *.ilk # produced by debugging

