# makefile for nauty 2.8
# @configure_input@

SHELL=@SHELL@
CC=@CC@
CFLAGS=@CFLAGS@ @MORECFLAGS@
SAFECFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@ @LIBS@
LOK=@lok@         # 0 if no 64-bit integers
TESTPROGS=@testprogs@
EXEEXT=@EXEEXT@

# Trailing spaces in the following will cause problems

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
includedir=@includedir@
pkgconfigexecdir=${prefix}/libdata/pkgconfig

INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
MKDIR_P=@MKDIR_P@

SMALL=-DMAXN=WORDSIZE
S1=-DMAXN=WORDSIZE -DWORDSIZE=16
W1=-DMAXN=WORDSIZE -DWORDSIZE=32
L1=-DMAXN=WORDSIZE -DWORDSIZE=64
S=-DWORDSIZE=16
W=-DWORDSIZE=32
L=-DWORDSIZE=64

CCOBJ=${CC} -c ${CFLAGS} -o $@
GTOOLSH=gtools.h nauty.h naututil.h nausparse.h naurng.h gutils.h \
  naugroup.h nautinv.h schreier.h nautycliquer.h traces.h \
  naugstrings.h planarity.h quarticirred28.h
GTOOLS=copyg listg labelg dretog amtog geng complg showg NRswitchg \
  biplabg addedgeg deledgeg countg pickg genrang newedgeg catg genbg \
  directg gentreeg genquarticg underlyingg assembleg gengL addptg \
  ranlabg multig planarg gentourng linegraphg watercluster2 dretodot \
  subdivideg vcolg delptg cubhamg twohamg hamheuristic converseg \
  genposetg nbrhoodg genspecialg edgetransg genbgL dreadnaut \
  ancestorg productg dimacs2g @shortg_or_null@
GLIBS=nauty.a nauty1.a nautyS.a nautyS1.a nautyW.a nautyW1.a nautyL.a nautyL1.a
PCFILE=nauty.pc

# @edit_msg@

all : nauty gtools ;

nauty : dreadnaut ${GLIBS} ;

gtools : ${GTOOLS} ;

NAUTYO=nauty.o nautil.o nausparse.o naugraph.o schreier.o naurng.o
NAUTY1O=nauty1.o nautil1.o nausparse.o naugraph1.o schreier.o naurng.o
NAUTYSO=nautyS.o nautilS.o nausparseS.o naugraphS.o schreierS.o naurng.o
NAUTYS1O=nautyS1.o nautilS1.o nausparseS.o naugraphS1.o schreierS.o naurng.o
NAUTYWO=nautyW.o nautilW.o nausparseW.o naugraphW.o schreierW.o naurng.o
NAUTYW1O=nautyW1.o nautilW1.o nausparseW.o naugraphW1.o schreierW.o naurng.o
NAUTYLO=nautyL.o nautilL.o nausparseL.o naugraphL.o schreierL.o naurng.o
NAUTYL1O=nautyL1.o nautilL1.o nausparseL.o naugraphL1.o schreierL.o naurng.o
INVO=nautinv.o nautinv1.o nautinvS.o nautinvS1.o nautinvW.o nautinvW1.o \
     nautinvL.o nautinvL1.o
UTILO=naututil.o naututil1.o naututilS.o naututilS1.o naututilW.o \
     naututilW1.o naututilL.o naututilL1.o
GUTILO=gutil1.o gutil1W.o gutil1W1.o gutil1L.o gutil1L1.o \
     gutil2.o gutil2W.o gutil2W1.o gutil2L.o gutil2L1.o
OTHERO=dreadnaut.o nautycliquer.o nautycliquerW.o nautycliquerL.o \
     traces.o gtools.o gtoolsW.o gtoolsL.o \
     gtnauty.o gtnautyL.o gtnautyL1.o gtnautyW.o gtnautyW1.o naugroup.o \
     naugroup.o naugroupW.o naugroupL.o

nauty.o: nauty.h schreier.h nauty.c
	${CCOBJ} nauty.c
nauty1.o: nauty.h schreier.h nauty.c
	${CCOBJ} ${SMALL} nauty.c
nautyS.o: nauty.h schreier.h nauty.c
	${CCOBJ} ${S} nauty.c
nautyS1.o: nauty.h schreier.h nauty.c
	${CCOBJ} ${S1} nauty.c
nautyW.o: nauty.h schreier.h nauty.c
	${CCOBJ} ${W} nauty.c
nautyW1.o: nauty.h schreier.h nauty.c
	${CCOBJ} ${W1} nauty.c
nautyL.o: nauty.h schreier.h nauty.c
	${CCOBJ} ${L} nauty.c
nautyL1.o: nauty.h schreier.h nauty.c
	${CCOBJ} ${L1} nauty.c

nautil.o: nauty.h nautil.c sorttemplates.c
	${CCOBJ} nautil.c
nautil1.o: nauty.h nautil.c sorttemplates.c
	${CCOBJ} ${SMALL} nautil.c
nautilS.o: nauty.h nautil.c sorttemplates.c
	${CCOBJ} ${S} nautil.c
nautilS1.o: nauty.h nautil.c sorttemplates.c
	${CCOBJ} ${S1} nautil.c
nautilW.o: nauty.h nautil.c sorttemplates.c
	${CCOBJ} ${W} nautil.c
nautilW1.o: nauty.h nautil.c sorttemplates.c
	${CCOBJ} ${W1} nautil.c
nautilL.o: nauty.h nautil.c sorttemplates.c
	${CCOBJ} ${L} nautil.c
nautilL1.o: nauty.h nautil.c sorttemplates.c
	${CCOBJ} ${L1} nautil.c

naugraph.o: nauty.h naugraph.c
	${CCOBJ} naugraph.c
naugraph1.o: nauty.h naugraph.c
	${CCOBJ} ${SMALL} naugraph.c
naugraphS.o: nauty.h naugraph.c
	${CCOBJ} ${S} naugraph.c
naugraphS1.o: nauty.h naugraph.c
	${CCOBJ} ${S1} naugraph.c
naugraphW.o: nauty.h naugraph.c
	${CCOBJ} ${W} naugraph.c
naugraphW1.o: nauty.h naugraph.c
	${CCOBJ} ${W1} naugraph.c
naugraphL.o: nauty.h naugraph.c
	${CCOBJ} ${L} naugraph.c
naugraphL1.o: nauty.h naugraph.c
	${CCOBJ} ${L1} naugraph.c

naututil.o: nauty.h naututil.h nausparse.h naututil.c
	${CCOBJ} naututil.c
naututil1.o: nauty.h naututil.h nausparse.h naututil.c
	${CCOBJ} ${SMALL} naututil.c
naututilS.o: nauty.h naututil.h nausparse.h naututil.c 
	${CCOBJ} ${S} naututil.c
naututilS1.o: nauty.h naututil.h nausparse.h naututil.c
	${CCOBJ} ${S1} naututil.c
naututilW.o: nauty.h naututil.h nausparse.h naututil.c
	${CCOBJ} ${W} naututil.c
naututilW1.o: nauty.h naututil.h nausparse.h naututil.c
	${CCOBJ} ${W1} naututil.c
naututilL.o: nauty.h naututil.h nausparse.h naututil.c
	${CCOBJ} ${L} naututil.c
naututilL1.o: nauty.h naututil.h nausparse.h naututil.c
	${CCOBJ} ${L1} naututil.c

nautinv.o: nauty.h naututil.h nautinv.c
	${CCOBJ} nautinv.c
nautinv1.o: nauty.h naututil.h nautinv.c
	${CCOBJ} ${SMALL} nautinv.c
nautinvS.o: nauty.h naututil.h nautinv.c
	${CCOBJ} ${S} nautinv.c
nautinvS1.o: nauty.h naututil.h nautinv.c
	${CCOBJ} ${S1} nautinv.c
nautinvW.o: nauty.h naututil.h nautinv.c
	${CCOBJ} ${W} nautinv.c 
nautinvW1.o: nauty.h naututil.h nautinv.c
	${CCOBJ} ${W1} nautinv.c
nautinvL.o: nauty.h naututil.h nautinv.c
	${CCOBJ} ${L} nautinv.c
nautinvL1.o: nauty.h naututil.h nautinv.c
	${CCOBJ} ${L1} nautinv.c

schreier.o : nauty.h naurng.h schreier.h schreier.c
	${CCOBJ} schreier.c
schreierS.o : nauty.h naurng.h schreier.h schreier.c
	${CCOBJ} ${S} schreier.c
schreierW.o : nauty.h naurng.h schreier.h schreier.c
	${CCOBJ} ${W} schreier.c
schreierL.o : nauty.h naurng.h schreier.h schreier.c
	${CCOBJ} ${L} schreier.c

nausparse.o : nauty.h nausparse.h nausparse.c sorttemplates.c
	${CCOBJ} nausparse.c
nausparseS.o: nauty.h nausparse.h nausparse.c sorttemplates.c
	${CCOBJ} ${S} nausparse.c
nausparseW.o: nauty.h nausparse.h nausparse.c sorttemplates.c
	${CCOBJ} ${W} nausparse.c
nausparseL.o: nauty.h nausparse.h nausparse.c sorttemplates.c
	${CCOBJ} ${L} nausparse.c

traces.o : nauty.h naurng.h schreier.h traces.h nausparse.h traces.c
	${CCOBJ} traces.c
tracesS.o : nauty.h naurng.h schreier.h traces.h nausparse.h traces.c
	${CCOBJ} ${S} traces.c
tracesW.o : nauty.h naurng.h schreier.h traces.h nausparse.h traces.c
	${CCOBJ} ${W} traces.c
tracesL.o : nauty.h naurng.h schreier.h traces.h nausparse.h traces.c
	${CCOBJ} ${L} traces.c

gtools.o : ${GTOOLSH} gtools.c
	${CCOBJ} gtools.c
gtoolsS.o : ${GTOOLSH} gtools.c
	${CCOBJ} ${S} gtools.c
gtoolsW.o : ${GTOOLSH} gtools.c
	${CCOBJ} ${W} gtools.c
gtoolsL.o : ${GTOOLSH} gtools.c
	${CCOBJ} ${L} gtools.c

nautaux.o: nautaux.h nauty.h naututil.h nautaux.c
	${CCOBJ} nautaux.c
nautauxS.o: nautaux.h nauty.h naututil.h nautaux.c
	${CCOBJ} ${S} nautaux.c
nautauxW.o: nautaux.h nauty.h naututil.h nautaux.c
	${CCOBJ} ${W} nautaux.c
nautauxL.o: nautaux.h nauty.h naututil.h nautaux.c
	${CCOBJ} ${L} nautaux.c

gtnauty.o : ${GTOOLSH} gtnauty.c sorttemplates.c
	${CCOBJ} gtnauty.c
gtnautyL1.o : ${GTOOLSH} gtnauty.c sorttemplates.c
	${CCOBJ} ${L1} gtnauty.c
gtnautyL.o : ${GTOOLSH} gtnauty.c sorttemplates.c
	${CCOBJ} ${L} gtnauty.c
gtnautyW1.o : ${GTOOLSH} gtnauty.c sorttemplates.c
	${CCOBJ} ${W1} gtnauty.c
gtnautyW.o : ${GTOOLSH} gtnauty.c sorttemplates.c
	${CCOBJ} ${W} gtnauty.c
gtnautyS1.o : ${GTOOLSH} gtnauty.c sorttemplates.c
	${CCOBJ} ${S1} gtnauty.c
gtnautyS.o : ${GTOOLSH} gtnauty.c sorttemplates.c
	${CCOBJ} ${S} gtnauty.c

naurng.o: naurng.c nauty.h
	${CCOBJ} naurng.c
rng.o: rng.c nauty.h
	${CCOBJ} rng.c

dreadnaut: dreadnaut.c naututil.o nautinv.o traces.o gtools.o ${NAUTYO}
	${CC} -o dreadnaut ${SAFECFLAGS} dreadnaut.c naututil.o \
		nautinv.o gtools.o traces.o ${NAUTYO} ${LDFLAGS}
dreadnautL: dreadnaut.c naututilL.o nautyL.o nautilL.o nautinvL.o \
	     nausparseL.o naugraphL.o naurng.o schreierL.o tracesL.o gtoolsL.o
	${CC} -o dreadnautL ${SAFECFLAGS} ${L} dreadnaut.c naututilL.o \
	     nautyL.o nautilL.o nautinvL.o naugraphL.o naurng.o gtoolsL.o \
	     nausparseL.o schreierL.o tracesL.o ${LDFLAGS}
dreadnaut1: dreadnaut.c naututil1.o nauty1.o nautil1.o nautinv1.o \
	     nausparse.o naugraph1.o naurng.o schreier.o traces.o gtools.o
	${CC} -o dreadnaut1 ${SAFECFLAGS} ${SMALL} dreadnaut.c naututil1.o \
	     nauty1.o nautil1.o nautinv1.o naugraph1.o naurng.o gtools.o \
	     nausparse.o schreier.o traces.o ${LDFLAGS}

nauty.a: ${NAUTYO} traces.o gtools.o naututil.o nautinv.o \
			gutil1.o gutil2.o gtnauty.o naugroup.o nautycliquer.o
	rm -f nauty.a
	${AR} crs nauty.a ${NAUTYO} traces.o gtools.o naututil.o \
		 nautinv.o gutil1.o gutil2.o gtnauty.o naugroup.o \
		 naurng.o schreier.o nautycliquer.o

nauty1.a: ${NAUTY1O} traces.o gtools.o naututil1.o nautinv1.o \
	   gutil1.o gutil2.o gtnauty.o naugroup.o nautycliquer.o
	rm -f nauty1.a
	${AR} crs nauty1.a ${NAUTY1O} traces.o gtools.o naututil1.o \
	   nautinv1.o gutil1.o gutil2.o gtnauty.o naugroup.o nautycliquer.o

nautyW.a: ${NAUTYWO} traces.o gtoolsW.o naututilW.o nautinvW.o \
	   gutil1W.o gutil2W.o gtnautyW.o naugroupW.o nautycliquerW.o
	rm -f nautyW.a
	${AR} crs nautyW.a ${NAUTYWO} traces.o gtoolsW.o naututilW.o \
	   nautinvW.o gutil1W.o gutil2W.o gtnautyW.o naugroupW.o nautycliquerW.o

nautyW1.a: ${NAUTYW1O} traces.o gtoolsW.o naututilW1.o nautinvW1.o \
	   gutil1W1.o gutil2W1.o gtnautyW1.o naugroupW.o nautycliquerW.o
	rm -f nautyW1.a
	${AR} crs nautyW1.a ${NAUTYW1O} traces.o gtoolsW.o naututilW1.o \
	   nautinvW1.o gutil1W1.o gutil2W1.o gtnautyW1.o naugroupW.o nautycliquerW.o

nautyS.a: ${NAUTYSO} traces.o gtoolsS.o naututilS.o nautinvS.o \
	   gutil1S.o gutil2S.o gtnautyS.o naugroupS.o nautycliquerS.o
	rm -f nautyS.a
	${AR} crs nautyS.a ${NAUTYSO} traces.o gtoolsS.o naututilS.o \
	   nautinvS.o gutil1S.o gutil2S.o gtnautyS.o naugroupS.o nautycliquerS.o

nautyS1.a: ${NAUTYS1O} traces.o gtoolsS.o naututilS1.o nautinvS1.o \
	   gutil1S1.o gutil2S1.o gtnautyS1.o naugroupS.o nautycliquerS.o
	rm -f nautyS1.a
	${AR} crs nautyS1.a ${NAUTYS1O} traces.o gtoolsS.o naututilS1.o \
	   nautinvS1.o gutil1S1.o gutil2S1.o gtnautyS1.o naugroupS.o nautycliquerS.o

nautyL.a: ${NAUTYLO} traces.o gtoolsL.o naututilL.o nautinvL.o \
	   gutil1L.o gutil2L.o gtnautyL.o naugroupL.o nautycliquerL.o
	rm -f nautyL.a
	${AR} crs nautyL.a ${NAUTYLO} traces.o gtoolsL.o naututilL.o \
	   nautinvL.o gutil1L.o gutil2L.o gtnautyL.o naugroupL.o nautycliquerL.o

nautyL1.a: ${NAUTYL1O} traces.o gtoolsL.o naututilL1.o nautinvL1.o \
	   gutil1L1.o gutil2L1.o gtnautyL1.o naugroupL.o nautycliquerL.o
	rm -f nautyL1.a
	${AR} crs nautyL1.a ${NAUTYL1O} traces.o gtoolsL.o naututilL1.o \
	   nautinvL1.o gutil1L1.o gutil2L1.o gtnautyL1.o naugroupL.o nautycliquerL.o

clean:
	rm -f ${NAUTYO} ${NAUTY1O} ${NAUTYSO} ${NAUTYS1O} ${NAUTYLO} ${NAUTYL1O} \
              ${NAUTYWO} ${NAUTYW1O} ${UTILO} ${GUTILO} ${OTHERO} ${INVO} \
              config.log config.cache config.status \
              nautestS nautestW nautestL naucompare nauty*.a ${TESTPROGS}

gutil1.o : ${GTOOLSH} gutils.h gutil1.c
	${CCOBJ} gutil1.c
gutil2.o : ${GTOOLSH} gutils.h gutil2.c
	${CCOBJ} gutil2.c
gutil1S1.o : ${GTOOLSH} gutils.h gutil1.c
	${CCOBJ} ${S1} gutil1.c
gutil2S1.o : ${GTOOLSH} gutils.h gutil2.c
	${CCOBJ} ${S1} gutil2.c
gutil1W1.o : ${GTOOLSH} gutils.h gutil1.c
	${CCOBJ} ${W1} gutil1.c
gutil2W1.o : ${GTOOLSH} gutils.h gutil2.c
	${CCOBJ} ${W1} gutil2.c
gutil1L1.o : ${GTOOLSH} gutils.h gutil1.c
	${CCOBJ} ${L1} gutil1.c
gutil2L1.o : ${GTOOLSH} gutils.h gutil2.c
	${CCOBJ} ${L1} gutil2.c
gutil1W.o : ${GTOOLSH} gutils.h gutil1.c
	${CCOBJ} ${W} gutil1.c
gutil2W.o : ${GTOOLSH} gutils.h gutil2.c
	${CCOBJ} ${W} gutil2.c
gutil1S.o : ${GTOOLSH} gutils.h gutil1.c
	${CCOBJ} ${S} gutil1.c
gutil2S.o : ${GTOOLSH} gutils.h gutil2.c
	${CCOBJ} ${S} gutil2.c
gutil1L.o : ${GTOOLSH} gutils.h gutil1.c
	${CCOBJ} ${L} gutil1.c
gutil2L.o : ${GTOOLSH} gutils.h gutil2.c
	${CCOBJ} ${L} gutil2.c

nbrhoodg : ${GTOOLSH} nbrhoodg.c gtools.o gtnauty.o ${NAUTYO}
	${CC} -o nbrhoodg ${CFLAGS} nbrhoodg.c gtools.o gtnauty.o ${NAUTYO} ${LDFLAGS}

productg : ${GTOOLSH} productg.c gtools.o ${NAUTYO}
	${CC} -o productg ${CFLAGS} productg.c gtools.o ${NAUTYO} ${LDFLAGS}

ancestorg : ${GTOOLSH} ancestorg.c gtools.o ${NAUTYO}
	${CC} -o ancestorg ${CFLAGS} ancestorg.c gtools.o ${NAUTYO} ${LDFLAGS}

dimacs2g : ${GTOOLSH} dimacs2g.c naututil.o gtools.o ${NAUTYO}
	${CC} -o dimacs2g ${CFLAGS} dimacs2g.c naututil.o gtools.o ${NAUTYO} ${LDFLAGS}

catg : ${GTOOLSH} catg.c gtools.o
	${CC} -o catg ${CFLAGS} catg.c gtools.o ${LDFLAGS}

copyg : ${GTOOLSH} copyg.c gtools.o
	${CC} -o copyg ${CFLAGS} copyg.c gtools.o ${LDFLAGS}

addptg : ${GTOOLSH} addptg.c gtools.o gtnauty.o ${NAUTYO}
	${CC} -o addptg ${CFLAGS} addptg.c ${NAUTYO} gtnauty.o gtools.o ${LDFLAGS}

genspecialg : ${GTOOLSH} genspecialg.c ${NAUTYO} gtools.o
	${CC} -o genspecialg ${CFLAGS} genspecialg.c ${NAUTYO} gtools.o ${LDFLAGS}

listg : ${GTOOLSH} listg.c gtools.o nautil.o
	${CC} -o listg ${CFLAGS} listg.c gtools.o nautil.o ${LDFLAGS}

labelg : ${GTOOLSH} naututil.h labelg.c gtools.o gtnauty.o ${NAUTYO} \
            nautinv.o nausparse.h gutils.h gutil2.o traces.h traces.o naututil.o
	${CC} -o labelg ${SAFECFLAGS} labelg.c gtools.o gtnauty.o naututil.o \
	    nautinv.o gutil2.o traces.o ${NAUTYO} ${LDFLAGS}

shortg : ${GTOOLSH} shortg.c gtools.o gtnauty.o ${NAUTYO} naututil.o \
            nausparse.h gutils.h gutil2.o nautinv.h nautinv.o traces.o
	${CC} -o shortg ${CFLAGS} shortg.c gtools.o gtnauty.o nautinv.o \
            ${NAUTYO} gutil2.o naututil.o traces.o ${LDFLAGS}

dretog : ${GTOOLSH} dretog.c naututil.o gtools.o ${NAUTYO} 
	${CC} -o dretog ${CFLAGS} dretog.c naututil.o gtools.o \
	    ${NAUTYO} ${LDFLAGS}

dretodot : ${GTOOLSH} dretodot.c naututil.o gtools.o \
		traces.o traces.h ${NAUTYO} 
	${CC} -o dretodot ${CFLAGS} dretodot.c naututil.o gtools.o \
	    traces.o ${NAUTYO} ${LDFLAGS} -lm

amtog : ${GTOOLSH} amtog.c gtools.o ${NAUTYO}
	${CC} -o amtog ${CFLAGS} amtog.c gtools.o ${NAUTYO} ${LDFLAGS}

genbg : ${GTOOLSH} genbg.c gtoolsW.o nautyW1.o nautilW1.o naugraphW1.o \
	    schreierW.o naurng.o
	${CC} -o genbg ${CFLAGS} ${W1} genbg.c gtoolsW.o schreierW.o \
		nautyW1.o nautilW1.o naugraphW1.o naurng.o ${LDFLAGS}

genbgL : ${GTOOLSH} genbg.c gtoolsL.o nautyL1.o nautilL1.o naugraphL1.o \
	    schreierL.o naurng.o
	${CC} -o genbgL ${CFLAGS} ${L1} -DMAXN1=30 genbg.c gtoolsL.o \
	    schreierL.o naurng.o nautyL1.o nautilL1.o naugraphL1.o ${LDFLAGS}

geng : ${GTOOLSH} geng.c gtoolsW.o nautyW1.o nautilW1.o naugraphW1.o schreier.o naurng.o
	${CC} -o geng ${CFLAGS} ${W1} geng.c gtoolsW.o nautyW1.o \
		nautilW1.o naugraphW1.o schreier.o naurng.o ${LDFLAGS}

gengL : ${GTOOLSH} geng.c gtoolsL.o nautyL1.o nautilL1.o naugraphL1.o schreier.o naurng.o
	${CC} -o gengL ${CFLAGS} ${L1} geng.c gtoolsL.o nautyL1.o \
		nautilL1.o naugraphL1.o schreier.o naurng.o ${LDFLAGS}

gentourng : ${GTOOLSH} gentourng.c gtoolsW.o nautyW1.o nautilW1.o \
	    naugraphW1.o schreier.o naurng.o
	${CC} -o gentourng ${CFLAGS} -DMAXN=24 $W gentourng.c gtoolsW.o nautyW1.o \
		nautilW1.o naugraphW1.o schreier.o naurng.o ${LDFLAGS}

genquarticg : ${GTOOLSH} genquarticg.c gtoolsL.o nautyL1.o nautilL1.o \
	    naugraphL1.o schreierL.o naurng.o quarticirred28.h
	${CC} -o genquarticg ${CFLAGS} genquarticg.c gtoolsL.o nautyL1.o \
		nautilL1.o naugraphL1.o schreierL.o naurng.o ${LDFLAGS}

gentreeg : gentreeg.c gtools.o nauty.h gtools.h
	${CC} -o gentreeg ${CFLAGS} gentreeg.c gtools.o ${LDFLAGS}

genrang : ${GTOOLSH} genrang.c gtools.o naututil.o ${NAUTYO}
	${CC} -o genrang ${CFLAGS} genrang.c \
		gtools.o naututil.o ${NAUTYO} ${LDFLAGS}

complg : ${GTOOLSH} complg.c gtools.o gtnauty.o ${NAUTYO}
	${CC} -o complg ${CFLAGS} complg.c gtools.o gtnauty.o \
		${NAUTYO} ${LDFLAGS}

cubhamg : ${GTOOLSH} cubhamg.c gtools.o ${NAUTYO}
	${CC} -o cubhamg ${CFLAGS} cubhamg.c gtools.o \
		${NAUTYO} ${LDFLAGS}

twohamg : ${GTOOLSH} twohamg.c gtools.o ${NAUTYO}
	${CC} -o twohamg ${CFLAGS} twohamg.c gtools.o \
		${NAUTYO} ${LDFLAGS}

hamheuristic : ${GTOOLSH} hamheuristic.c gtools.o ${NAUTYO}
	${CC} -o hamheuristic ${CFLAGS} hamheuristic.c gtools.o \
		${NAUTYO} ${LDFLAGS}

converseg : ${GTOOLSH} converseg.c gtools.o ${NAUTYO} nautinv.o
	${CC} -o converseg ${CFLAGS} converseg.c nautinv.o gtools.o \
		${NAUTYO} ${LDFLAGS}

assembleg : ${GTOOLSH} assembleg.c gtools.o ${NAUTYO}
	${CC} -o assembleg ${CFLAGS} assembleg.c gtools.o \
		${NAUTYO} ${LDFLAGS}

underlyingg : ${GTOOLSH} underlyingg.c gtools.o ${NAUTYO}
	${CC} -o underlyingg ${CFLAGS} underlyingg.c gtools.o \
		${NAUTYO} ${LDFLAGS}

linegraphg : ${GTOOLSH} linegraphg.c gtools.o ${NAUTYO}
	${CC} -o linegraphg ${CFLAGS} linegraphg.c gtools.o \
		${NAUTYO} ${LDFLAGS}

subdivideg : ${GTOOLSH} subdivideg.c gtools.o ${NAUTYO}
	${CC} -o subdivideg ${CFLAGS} subdivideg.c gtools.o \
		${NAUTYO} ${LDFLAGS}

vcolg : ${GTOOLSH} vcolg.c gtools.o ${NAUTYO} naugroup.o gtnauty.o \
		 nautinv.o naututil.o naugroup.h gutils.h
	${CC} -o vcolg ${CFLAGS} vcolg.c gtnauty.o naututil.o gutil2.o \
		nautinv.o gtools.o naugroup.o ${NAUTYO} ${LDFLAGS}

edgetransg : ${GTOOLSH} edgetransg.c gtools.o ${NAUTYO} naugroup.o \
		gtnauty.o naututil.o nautinv.o naugroup.h
	${CC} -o edgetransg ${CFLAGS} edgetransg.c gtnauty.o naututil.o \
		nautinv.o gtools.o naugroup.o ${NAUTYO} ${LDFLAGS}

biplabg : ${GTOOLSH} gutils.h biplabg.c gtools.o gutil1.o ${NAUTYO}
	${CC} -o biplabg ${CFLAGS} biplabg.c \
		gtools.o gutil1.o ${NAUTYO} ${LDFLAGS}

ranlabg : ${GTOOLSH} ranlabg.c gtools.o ${NAUTYO}
	${CC} -o ranlabg ${CFLAGS} ranlabg.c gtools.o ${NAUTYO} ${LDFLAGS}

NRswitchg : ${GTOOLSH} NRswitchg.c gtools.o gtnauty.o ${NAUTYO}
	${CC} -o NRswitchg ${CFLAGS} NRswitchg.c gtools.o gtnauty.o \
		 ${NAUTYO} ${LDFLAGS}

deledgeg : ${GTOOLSH} deledgeg.c gtools.o gtnauty.o ${NAUTYO}
	${CC} -o deledgeg ${CFLAGS} deledgeg.c gtools.o gtnauty.o \
		 ${NAUTYO} ${LDFLAGS}

delptg : ${GTOOLSH} delptg.c gtools.o gtnauty.o ${NAUTYO}
	${CC} -o delptg ${CFLAGS} delptg.c gtools.o gtnauty.o \
		 ${NAUTYO} ${LDFLAGS}

addedgeg : ${GTOOLSH} gutils.h addedgeg.c gtools.o gtnauty.o gutil1.o ${NAUTYO}
	${CC} -o addedgeg ${CFLAGS} addedgeg.c gtools.o gtnauty.o \
	        gutil1.o ${NAUTYO} ${LDFLAGS}

newedgeg : ${GTOOLSH} gutils.h newedgeg.c gtools.o gtnauty.o ${NAUTYO}
	${CC} -o newedgeg ${CFLAGS} newedgeg.c gtools.o gtnauty.o \
		 ${NAUTYO} ${LDFLAGS}

pickg : ${GTOOLSH} gutils.h testg.c splay.c ${NAUTYO} nautycliquer.h \
	     gtools.o gtnauty.o gutil1.o gutil2.o nautinv.o nautycliquer.o
	${CC} -o pickg ${SAFECFLAGS} testg.c gtools.o gtnauty.o gutil1.o \
	        gutil2.o nautinv.o nautycliquer.o ${NAUTYO} ${LDFLAGS}

countg : ${GTOOLSH} gutils.h testg.c splay.c ${NAUTYO} nautycliquer.h \
	     gtools.o gtnauty.o gutil1.o gutil2.o nautinv.o nautycliquer.o
	${CC} -o countg ${SAFECFLAGS} testg.c gtools.o gtnauty.o gutil1.o \
	         gutil2.o nautinv.o nautycliquer.o ${NAUTYO} ${LDFLAGS} 

directg : ${GTOOLSH} naugroup.h directg.c  gtools.o naugroup.o ${NAUTYO}
	${CC} -o directg ${CFLAGS} directg.c gtools.o \
                ${NAUTYO} naugroup.o ${LDFLAGS}

multig : ${GTOOLSH} naugroup.h multig.c gtools.o gtnauty.o naugroup.o ${NAUTYO}
	${CC} -o multig ${CFLAGS} multig.c gtools.o gtnauty.o \
                ${NAUTYO} naugroup.o ${LDFLAGS}

planarg : ${GTOOLSH} planarg.c gtools.o planarity.c planarity.h
	${CC} -o planarg ${CFLAGS} \
		planarg.c planarity.c gtools.o ${LDFLAGS}

watercluster2 : ${GTOOLSH} nauty.h watercluster2.c gtoolsW.o ${NAUTYW1O}
	${CC} -o watercluster2 ${CFLAGS} ${W1} watercluster2.c \
                 gtoolsW.o ${NAUTYW1O} ${LDFLAGS}

genposetg : ${GTOOLSH} nauty.h genposetg.c gtoolsS.o ${NAUTYS1O}
	${CC} -o genposetg ${CFLAGS} ${S1} genposetg.c \
                 gtoolsS.o ${NAUTYS1O} ${LDFLAGS}

showg : showg.c
	${CC} -o showg ${CFLAGS} showg.c ${LDFLAGS}

readg : showg
	echo "*** readg is now called showg ***"

sumlines : sumlines.c
	${CC} -o sumlines ${CFLAGS} sumlines.c ${LDFLAGS} -lgmp

blisstog : ${GTOOLSH} blisstog.c gtools.o ${NAUTYO}
	${CC} -o blisstog ${CFLAGS} blisstog.c gtools.o \
                ${NAUTYO} ${LDFLAGS}

bliss2dre : ${GTOOLSH} bliss2dre.c gtools.o ${NAUTYO}
	${CC} -o bliss2dre ${CFLAGS} bliss2dre.c gtools.o \
                ${NAUTYO} ${LDFLAGS}

testlabelling : testlabelling.c nauty.h nauty.a
	${CC} -o testlabelling -g testlabelling.c traces.c nauty.a ${LDFLAGS}

naugroup.o : nauty.h naugroup.h naugroup.c
	${CCOBJ} naugroup.c
naugroupS.o : nauty.h naugroup.h naugroup.c
	${CCOBJ} ${S} naugroup.c
naugroupW.o : nauty.h naugroup.h naugroup.c
	${CCOBJ} ${W} naugroup.c
naugroupL.o : nauty.h naugroup.h naugroup.c
	${CCOBJ} ${L} naugroup.c

nautycliquer.o : nauty.h nautycliquer.c nautycliquer.h
	${CCOBJ} nautycliquer.c
nautycliquerS.o : nauty.h naugroup.h naugroup.c nautycliquer.c nautycliquer.h
	${CCOBJ} ${S} nautycliquer.c
nautycliquerW.o : nauty.h naugroup.h naugroup.c nautycliquer.c nautycliquer.h
	${CCOBJ} ${W} nautycliquer.c
nautycliquerL.o : nauty.h naugroup.h naugroup.c nautycliquer.c nautycliquer.h
	${CCOBJ} ${L} nautycliquer.c

nautyex1 : nauty.h nautyex1.c nauty.a
	${CC} -o nautyex1 ${CFLAGS} nautyex1.c nauty.a ${LDFLAGS}
nautyex2 : nauty.h nautyex2.c ${NAUTYO}
	${CC} -o nautyex2 ${CFLAGS} nautyex2.c nauty.a ${LDFLAGS}
nautyex3 : nauty.h nautyex3.c nauty.a
	${CC} -o nautyex3 ${CFLAGS} nautyex3.c nauty.a ${LDFLAGS}
nautyex4 : nauty.h nausparse.h nautyex4.c nauty.a
	${CC} -o nautyex4 ${CFLAGS} nautyex4.c nauty.a ${LDFLAGS}
nautyex5 : nauty.h nausparse.h nautyex5.c nauty.a
	${CC} -o nautyex5 ${CFLAGS} nautyex5.c nauty.a ${LDFLAGS}
nautyex6 : nauty.h nautyex6.c nauty.a
	${CC} -o nautyex6 ${CFLAGS} nautyex6.c nauty.a ${LDFLAGS}
nautyex7 : nauty.h nautyex7.c traces.h nauty.a
	${CC} -o nautyex7 ${CFLAGS} nautyex7.c nauty.a ${LDFLAGS}
nautyex8 : nauty.h nausparse.h nautyex8.c nauty.a
	${CC} -o nautyex8 ${CFLAGS} nautyex8.c nauty.a ${LDFLAGS}
nautyex9 : nauty.h nautyex9.c nauty.a
	${CC} -o nautyex9 ${CFLAGS} nautyex9.c nauty.a ${LDFLAGS}
nautyex10 : nauty.h nautyex10.c nauty.a
	${CC} -o nautyex10 ${CFLAGS} nautyex10.c nauty.a ${LDFLAGS}

# Libraries with thread-local storage

NAUTYC=nauty.c nautil.c nausparse.c naugraph.c schreier.c naurng.c \
        traces.c gtools.c naututil.c nautinv.c gutil1.c gutil2.c \
        gtnauty.c naugroup.c nautycliquer.c

nautyT.a : nauty.h gtools.h ${NAUTYC}
	rm -rf TLSlib_temp ; mkdir TLSlib_temp 
	( cd TLSlib_temp ; for f in ${NAUTYC} ; do cp ../$$f . ; done ; \
	${CC} ${CFLAGS} -I.. -c -DUSE_TLS *.c ; ${AR} rcs ../nautyT.a *.o ; \
	${CC} ${CFLAGS} ${SMALL} -I.. -c -DUSE_TLS *.c ; ${AR} rcs ../nautyT1.a *.o ; )
	rm -rf TLSlib_temp

nautyTW.a : nauty.h gtools.h ${NAUTYC}
	rm -rf TLSlib_Wtemp ; mkdir TLSlib_Wtemp 
	( cd TLSlib_Wtemp ; for f in ${NAUTYC} ; do cp ../$$f . ; done ; \
	${CC} ${CFLAGS} ${W} -I.. -c -DUSE_TLS *.c ; ${AR} rcs ../nautyTW.a *.o ; \
	${CC} ${CFLAGS} ${W1} -I.. -c -DUSE_TLS *.c ; ${AR} rcs ../nautyTW1.a *.o ; )
	rm -rf TLSlib_Wtemp

nautyTL.a : nauty.h gtools.h ${NAUTYC}
	rm -rf TLSlib_Ltemp ; mkdir TLSlib_Ltemp 
	( cd TLSlib_Ltemp ; for f in ${NAUTYC} ; do cp ../$$f . ; done ; \
	${CC} ${CFLAGS} ${L} -I.. -c -DUSE_TLS *.c ; ${AR} rcs ../nautyTL.a *.o ; \
	${CC} ${CFLAGS} ${L1} -I.. -c -DUSE_TLS *.c ; ${AR} rcs ../nautyTL1.a *.o ; )
	rm -rf TLSlib_Ltemp

TLSlibs: nautyT.a nautyTW.a nautyTL.a ;
nautyT1.a: nautyT.a ;
nautyTW1.a: nautyTW.a ;
nautyTL1.a: nautyTL.a ;

callgeng2 : nauty.h gtools.h callgeng2.c geng.c nautyTW1.a
	${CC} ${CFLAGS} ${W1} -o callgeng2 -pthread -DMAXN=WORDSIZE -DWORDSIZE=32 \
	-DUSE_TLS -DGENG_MAIN=geng_main -DSUMMARY=geng_summary \
	 callgeng2.c geng.c nautyTW1.a

# Test programs

testprogs: ${TESTPROGS} ;

checks: nauty gtools nautestS nautestW nautestL naucompare ${TESTPROGS}
	./runalltests

check: checks ;

naucompare : naucompare.c
	${CC} -o naucompare ${CFLAGS} naucompare.c ${LDFLAGS}

nautestS : nauty.h naututil.h nautest.c
	${CC} -o nautestS ${CFLAGS} ${S} nautest.c ${LDFLAGS}
nautestW : nauty.h naututil.h nautest.c
	${CC} -o nautestW ${CFLAGS} ${W} nautest.c ${LDFLAGS}
nautestL : nauty.h naututil.h nautest.c
	${CC} -o nautestL ${CFLAGS} ${L} nautest.c ${LDFLAGS}

dreadtest: dreadnaut.c nautinv.o ${NAUTYO} naututil.o traces.o gtools.o 
	${CC} -o dreadtest ${SAFECFLAGS} -DDREADTEST dreadnaut.c \
	    nautinv.o naututil.o traces.o gtools.o ${NAUTYO} ${LDFLAGS}
dreadtest1: dreadnaut.c nautinv1.o ${NAUTY1O} naututil1.o traces.o gtools.o 
	${CC} -o dreadtest1 ${SAFECFLAGS} ${SMALL} -DDREADTEST dreadnaut.c \
	    nautinv1.o naututil1.o traces.o gtools.o ${NAUTY1O} ${LDFLAGS}
dreadtestS: dreadnaut.c nautinvS.o ${NAUTYSO} naututilS.o tracesS.o gtoolsS.o 
	${CC} -o dreadtestS ${SAFECFLAGS} ${S} -DDREADTEST dreadnaut.c \
	    nautinvS.o naututilS.o tracesS.o gtoolsS.o ${NAUTYSO} ${LDFLAGS}
dreadtestS1: dreadnaut.c nautinvS1.o ${NAUTYS1O} naututilS1.o \
		tracesS.o gtoolsS.o 
	${CC} -o dreadtestS1 ${SAFECFLAGS} ${S1} -DDREADTEST dreadnaut.c \
	    nautinvS1.o naututilS1.o tracesS.o gtoolsS.o ${NAUTYS1O} ${LDFLAGS}
dreadtestW: dreadnaut.c nautinvW.o ${NAUTYWO} naututilW.o tracesW.o gtoolsW.o 
	${CC} -o dreadtestW ${SAFECFLAGS} ${W} -DDREADTEST dreadnaut.c \
	    nautinvW.o naututilW.o tracesW.o gtoolsW.o ${NAUTYWO} ${LDFLAGS}
dreadtestW1: dreadnaut.c nautinvW1.o ${NAUTYW1O} naututilW1.o \
		tracesW.o gtoolsW.o 
	${CC} -o dreadtestW1 ${SAFECFLAGS} ${W1} -DDREADTEST dreadnaut.c \
	    nautinvW1.o naututilW1.o tracesW.o gtoolsW.o ${NAUTYW1O} ${LDFLAGS}
dreadtestL: dreadnaut.c nautinvL.o ${NAUTYLO} naututilL.o tracesL.o gtoolsL.o 
	${CC} -o dreadtestL ${SAFECFLAGS} ${L} -DDREADTEST dreadnaut.c \
	    nautinvL.o naututilL.o tracesL.o gtoolsL.o ${NAUTYLO} ${LDFLAGS}
dreadtestL1: dreadnaut.c nautinvL1.o ${NAUTYL1O} naututilL1.o \
		tracesL.o gtoolsL.o 
	${CC} -o dreadtestL1 ${SAFECFLAGS} ${L1} -DDREADTEST dreadnaut.c \
	    nautinvL1.o naututilL1.o tracesL.o gtoolsL.o ${NAUTYL1O} ${LDFLAGS}
dreadtest4K: dreadnaut.c nausparse.c schreier.c naututil.c nauty.c \
	    nautil.c nautinv.c naugraph.c naurng.o gtools.c traces.c
	${CC} -o dreadtest4K ${SAFECFLAGS} -DMAXN=4096 -DDREADTEST \
	    dreadnaut.c naututil.c nauty.c nautil.c nautinv.c \
	    naugraph.c nausparse.c naurng.o schreier.c gtools.c \
	    traces.c ${LDFLAGS}

checks6: checks6.c ${GTOOLSH} gtools.o
	${CC} -o checks6 ${SAFECFLAGS} checks6.c gtools.o

install:
	${MKDIR_P} ${DESTDIR}${bindir} ${DESTDIR}${includedir} ${DESTDIR}${libdir} ${DESTDIR}${pkgconfigexecdir}
	${INSTALL} ${GTOOLS} ${DESTDIR}${bindir}
	${INSTALL_DATA} ${GTOOLSH} ${DESTDIR}${includedir}
	${INSTALL} ${GLIBS} ${DESTDIR}${libdir}
	for lib in ${GLIBS} ; do \
	   mv -f ${DESTDIR}${libdir}/$${lib} ${DESTDIR}${libdir}/lib$${lib} ; \
           case $${lib} in \
	      nauty.a) sed -e 's/LIBS/-lnauty/' -e 's/CFLGS//' \
                       ${PCFILE} > ${DESTDIR}${pkgconfigexecdir}/nauty.pc ;; \
	      nauty1.a) sed -e 's/LIBS/-lnauty1/' -e 's/CFLGS/-DMAXN=WORDSIZE/' \
                       ${PCFILE} > ${DESTDIR}${pkgconfigexecdir}/nauty1.pc ;; \
	      nautyS.a) sed -e 's/LIBS/-lnautyS/' -e 's/CFLGS/-DWORDSIZE=16/' \
                       ${PCFILE} > ${DESTDIR}${pkgconfigexecdir}/nautyS.pc ;; \
	      nautyS1.a) sed -e 's/LIBS/-lnautyS1/' -e 's/CFLGS/-DWORDSIZE=16 -DMAXN=WORDSIZE/' \
                       ${PCFILE} > ${DESTDIR}${pkgconfigexecdir}/nautyS1.pc ;; \
	      nautyW.a) sed -e 's/LIBS/-lnautyW/' -e 's/CFLGS/-DWORDSIZE=32/' \
                       ${PCFILE} > ${DESTDIR}${pkgconfigexecdir}/nautyW.pc ;; \
	      nautyW1.a) sed -e 's/LIBS/-lnautyW1/' -e 's/CFLGS/-DWORDSIZE=32 -DMAXN=WORDSIZE/' \
                       ${PCFILE} > ${DESTDIR}${pkgconfigexecdir}/nautyW1.pc ;; \
	      nautyL.a) sed -e 's/LIBS/-lnautyL/' -e 's/CFLGS/-DWORDSIZE=64/' \
                       ${PCFILE} > ${DESTDIR}${pkgconfigexecdir}/nautyL.pc ;; \
	      nautyL1.a) sed -e 's/LIBS/-lnautyL1/' -e 's/CFLGS/-DWORDSIZE=64 -DMAXN=WORDSIZE/' \
                       ${PCFILE} > ${DESTDIR}${pkgconfigexecdir}/nautyL1.pc ;; \
	      *.so) ;; *.dylib) ;; *.dll) ;; *.DLL) ;; \
	      *) echo "Unknown library" $${lib} ;; \
	   esac ; done

# @edit_msg@
