add support for 3d scenes, depth testing, lighting
[chaz/rasterize] / Makefile
1
2 PROJECT = project2
3 IUSE = CLIPPING DEPTH_TEST SMOOTH_COLOR \
4 EXTRA_INLINE NDEBUG RASTER_STATS RENDER_PROGRESS RENDER_TIMER
5
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
18
19 VIEWER = feh
20
21 CC = gcc
22 CFLAGS = -std=c99 -O2 -g -pg
23 CPPFLAGS= -MMD $(IUSE:%=-D%)
24 LDLIBS = -lm
25
26 SRCS = main.c common.c list.c raster.c rbtree.c scene.c
27 OBJS = $(SRCS:%.c=%.o)
28 DEPS = $(OBJS:%.o=%.d)
29
30 all: $(PROJECT)
31
32 $(PROJECT): $(OBJS)
33 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
34
35 clean:
36 rm -f $(PROJECT) $(OBJS) $(DEPS)
37
38 distclean: clean
39 rm -f tags gmon.out scene.ppm scene.bmp
40
41 dist:
42 git archive $(PROJECT) --prefix=$(PROJECT)/ --output=$(PROJECT).zip
43
44 run: $(PROJECT)
45 ./$< && $(VIEWER) scene.ppm
46
47 debug: $(PROJECT)
48 gdb ./$<
49
50 -include $(DEPS)
51 $(OBJS): Makefile
52
53 .PHONY: all clean distclean run debug
54
This page took 0.038688 seconds and 4 git commands to generate.