CC = gcc
CPP = g++
CFLAGS =  -g -Wall -O2
CPPFLAGS = -g -Wall -O2
LN = ln -s

ifeq (./cubes/.config, $(wildcard ./cubes/.config))
include ./cubes/.config
endif

# default:	
#		echo "Type: make config ; make cube-name"

solve-cube:	bedlam.o frame.o shape.o container.o templates.o
		$(CC) $(CFLAGS) -o solve-cube bedlam.o frame.o shape.o container.o templates.o -lstdc++ -lm

simple:		clean_links
		$(LN) ../cubes/simple/cubedata.h ./include/cubedata.h
		$(LN) ./cubes/simple/templates.cpp ./templates.cpp

complex:	clean_links
		$(LN) ../cubes/complex/cubedata.h ./include/cubedata.h
		$(LN) ./cubes/complex/templates.cpp ./templates.cpp

clean:
		rm -f *.o core
		rm -f `find . -name "*~" -print`

clobber:	clean clean_links
		rm -f solve-cube

clean_links:
		rm -f include/cubedata.h templates.cpp

%.o:		%.cpp
		$(CPP) $(CPPFLAGS) -c -o $@ $<

