# make file
# Written by Frederic Bois
# 22 June 2014
# Copyright (c) 2014 Frederic Bois.
#  This code is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  For more details
#  see the GNU General Public License at <http://www.gnu.org/licenses/> 


LEX  = flex
YACC = bison -y -d
CC   = gcc -o graph_sampler

GS_C_CODE = graph_sampler.c \
            concordance.c \
            degree.c \
            lex.yy.c \
            lists.c \
            matrices.c \
            motifs.c \
            outputs.c \
            random.c \
            topo_sort.c \
            y.tab.c 

GS_DEP    = $(GS_C_CODE) \
            graph_sampler.h \
            concordance.h \
            degree.h \
            lexerr.h \
            lists.h \
            matrices.h \
            motifs.h \
            outputs.h \
            random.h \
            topo_sort.h \
            y.tab.h

GS_DIST   = $(GS_DEP) \
            Makefile \
            gs_parser.y \
            gs_lexer.l \
            graph_sampler.texinfo \
            script.txt

:
graph_sampler: $(GS_DEP)
	       $(CC) -O3 $(GS_C_CODE) -lm

y.tab.c y.tab.h: gs_parser.y
	         $(YACC) gs_parser.y

lex.yy.c: gs_lexer.l y.tab.h
	  $(LEX) gs_lexer.l

run:
	graph_sampler script.txt

debug:  $(GS_DEP)
	$(CC) -Wall -g -DDEBUG $(GS_C_CODE)

info:   graph_sampler.texinfo
	makeinfo --force --no-split graph_sampler.texinfo

html:   graph_sampler.texinfo
	makeinfo --force --html --no-split graph_sampler.texinfo

distrib:
	tar -zcf gr.tgz $(GS_DIST)
