024bb482ab202cc43adbc2ad0baff74d6fb4ac6d
[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
7 # BACKFACE_CULLING prevent drawing triangles that are not facing forward
8 # CLIPPING turn on clipping (you really always want this)
9 # DEPTH_TEST enable the z buffer for depth testing
10 # EXPORT_BMP save scene as bitmap (enabled by default)
11 # EXPORT_PPM save scene as a PPM file (also enabled by default)
12 # EXTRA_INLINE allow the compiler to inline even more aggressively
13 # LIGHTING turn the lights on (experimental)
14 # NDEBUG disable assertions and other nonessential checks
15 # PRE_NORMALS[=n] pre-compute mesh normals at scene-loading time;
16 # set to 1 for per-face normals, 2 for averaged normals,
17 # or 3 to also enable caching the computed normals
18 # RASTER_STATS print triangle count and optimization savings at the end
19 # RENDER_PROGRESS print progress while drawing the scene
20 # RENDER_TIMER add a timer to see how long the renderer takes
21 # SMOOTH_COLOR interpolate colors smoothly between triangle vertices
22
23 VIEWER = feh
24
25 CC = gcc
26 CFLAGS = -std=c99 -O2 -g -pg
27 CPPFLAGS= -MMD $(IUSE:%=-D%)
28 LDLIBS = -lm
29
30 SRCS = main.c common.c list.c raster.c rbtree.c scene.c
31 OBJS = $(SRCS:%.c=%.o)
32 DEPS = $(OBJS:%.o=%.d)
33
34 all: $(PROJECT)
35
36 $(PROJECT): $(OBJS)
37 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
38
39 clean:
40 rm -f $(PROJECT) $(OBJS) $(DEPS)
41
42 distclean: clean
43 rm -f tags gmon.out scene.ppm scene.bmp
44
45 dist:
46 git archive $(PROJECT) --prefix=$(PROJECT)/ --output=$(PROJECT).zip
47
48 run: $(PROJECT)
49 ./$< && $(VIEWER) scene.ppm
50
51 debug: $(PROJECT)
52 gdb ./$<
53
54 -include $(DEPS)
55 $(OBJS): Makefile
56
57 .PHONY: all clean distclean run debug
58
This page took 0.039692 seconds and 3 git commands to generate.