3 IUSE = CLIPPING DEPTH_TEST SMOOTH_COLOR \
4 EXTRA_INLINE NDEBUG RASTER_STATS RENDER_PROGRESS RENDER_TIMER
6 # BACKFACE_CULLING avoid drawing triangles that are not facing forward
7 # CLIPPING turn on clipping (you really always want this)
8 # DEPTH_TEST enable the z buffer for depth testing
9 # EXTRA_INLINE allow the compiler to inline even more aggressively
10 # LIGHTING turn the lights on (experimental)
11 # NDEBUG disable assertions and other nonessential checks
12 # FIND_NORMALS[=n] pre-compute vertex normals at loading time
13 # set to 1 for per-face normals, 2 for averaged normals
14 # RASTER_STATS print triangle count and optimization savings at the end
15 # RENDER_PROGRESS print progress while drawing the scene
16 # RENDER_TIMER add a timer to see how long the renderer takes
17 # SMOOTH_COLOR interpolate colors smoothly between triangle vertices
22 CFLAGS = -std=c99 -O2 -g -pg
23 CPPFLAGS= -MMD $(IUSE:%=-D%)
26 SRCS = main.c common.c list.c raster.c rbtree.c scene.c
27 OBJS = $(SRCS:%.c=%.o)
28 DEPS = $(OBJS:%.o=%.d)
33 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
36 rm -f $(PROJECT) $(OBJS) $(DEPS)
39 rm -f tags gmon.out scene.ppm scene.bmp
42 git archive $(PROJECT) --prefix=$(PROJECT)/ --output=$(PROJECT).zip
45 ./$< && $(VIEWER) scene.ppm
53 .PHONY: all clean distclean run debug