COMPILER=gcc -g
PNDIR=../pnheaders/

static: plantCompiler.o filltmpl.fl.o supervisorCompiler.o templates.o

compexample.o: compexample.c *.h $(PNDIR)*.h
	$(COMPILER) -c -I$(PNDIR) compexample.c

plantCompiler.o: plantCompiler.c *.h $(PNDIR)*.h 
	$(COMPILER) -c -I$(PNDIR) plantCompiler.c

supervisorCompiler.o: supervisorCompiler.c *.h $(PNDIR)*.h
	$(COMPILER) -c -D ___USE_PTHREAD_LIB -I$(PNDIR) supervisorCompiler.c

filltmpl.fl.o: filltmpl.lex
	flex -Pfl -ofilltmpl.fl.c filltmpl.lex
	$(COMPILER) -c filltmpl.fl.c -I$(PNDIR)

templates.o: fl2str SupervisorTemplate.c ProcessTemplate.c spcommon.h
	./fl2str templates.c SupervisorTemplate.c ProcessTemplate.c spcommon.h
	$(COMPILER) -c templates.c

fl2str: fl2str.lex
	flex -ofl2str.yy.c fl2str.lex
	$(COMPILER) -o fl2str fl2str.yy.c

clean:
	rm *.o obj/*.o || true