# Makefile - Don Yang (uguu.org)
#
# Compiles, links, and runs on at least one linux box.  Your mileage
# may vary.
#
# If you can't get it to build, try using MesaGL:
#  http://www.mesa3d.org/
#
# And set libs+includes below to where the mesa libraries are built.
#
# Some systems don't like how some macros are defined before the
# headers are included.  On those systems, you may get things to
# compile by forcing some header files to be processed first:
#
#  gcc -O3 -include GL/glut.h koyomi.c -lGL -lGLU -lglut -o koyomi
#
# (GL/glut.h is usually the only one that fails)


target = koyomi
libs = -lGL -lGLU -lglut

all: $(target)

koyomi: koyomi.o
	gcc $(libs) $< -o $@

koyomi.o: koyomi.c
	gcc -O3 -c $< -o $@

texture.png: generate_env_map3.exe
	./$< | pnmtopng > $@

generate_env_map3.exe: generate_env_map3.c
	gcc -Wall -lm $< -o $@

clean:
	-rm -f koyomi koyomi.o texture.png *.exe

backup:
	-rm -f backup.tar.gz
	tar cf backup.tar *.c *.h *.txt sys/* Makefile makefile.msvc
	gzip -9 backup.tar
