PCN_BASE = /usr/local/pcn_2.0
TARGET = default
FLAVOR =
PCNCOMP = $(PCN_BASE)/bin/pcncomp
PCNCOMPFLAGS = $(FLAVOR) -target $(TARGET)

PAMS = loop.pam
OBJS =
PCNT = pcnt_loop
MAIN_MOD = loop
PROG_NAME = loop

all: $(PROG_NAME)

pams: $(PAMS)

$(PCNT).c: $(PAMS)
	$(PCNCOMP) $(PCNCOMPFLAGS) $(PAMS) -o $(PCNT).c -pcnt \
		-mm $(MAIN_MOD) -v

$(PROG_NAME): $(PCNT).o $(OBJS)
	$(PCNCOMP) $(PCNCOMPFLAGS) $(PCNT).o $(OBJS) -o $(PROG_NAME)

.SUFFIXES: .pcn .pam .c .o .f

.pcn.pam:
	$(PCNCOMP) $(PCNCOMPFLAGS) -c $*.pcn

.c.o:
	$(PCNCOMP) $(PCNCOMPFLAGS) -c $*.c

.f.o:
	$(PCNCOMP) $(PCNCOMPFLAGS) -c $*.f

clean:
	rm -f *.pam *.mod *~ $(PROG_NAME) *.dump pcnt* *.o
