X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=Makefile;h=16e0ee76a0e655f45b7f5fe8efb9c388a3e47f49;hb=03be53bf14d0c2e1e3e19356376491945cdd78c8;hp=0474ec9e1319692f700c1f5af503c24f5f5c92a9;hpb=c875478cdd823c7df8fdc859941bd9e5948c9315;p=chaz%2Frasterize diff --git a/Makefile b/Makefile index 0474ec9..16e0ee7 100644 --- a/Makefile +++ b/Makefile @@ -1,54 +1,43 @@ -PROJECT = project2 -IUSE = CLIPPING DEPTH_TEST SMOOTH_COLOR \ - EXTRA_INLINE NDEBUG RASTER_STATS RENDER_PROGRESS RENDER_TIMER - -# BACKFACE_CULLING avoid drawing triangles that are not facing forward -# CLIPPING turn on clipping (you really always want this) -# DEPTH_TEST enable the z buffer for depth testing -# EXTRA_INLINE allow the compiler to inline even more aggressively -# LIGHTING turn the lights on (experimental) -# NDEBUG disable assertions and other nonessential checks -# FIND_NORMALS[=n] pre-compute vertex normals at loading time -# set to 1 for per-face normals, 2 for averaged normals -# RASTER_STATS print triangle count and optimization savings at the end -# RENDER_PROGRESS print progress while drawing the scene -# RENDER_TIMER add a timer to see how long the renderer takes -# SMOOTH_COLOR interpolate colors smoothly between triangle vertices - -VIEWER = feh - -CC = gcc -CFLAGS = -std=c99 -O2 -g -pg +PROJECT = raytrace +IUSE = EXTRA_INLINE + +CXX = g++ +EXEEXT = +CXXFLAGS= -O2 -g -pg CPPFLAGS= -MMD $(IUSE:%=-D%) LDLIBS = -lm -SRCS = main.c common.c list.c raster.c rbtree.c scene.c -OBJS = $(SRCS:%.c=%.o) -DEPS = $(OBJS:%.o=%.d) +SRCS = main.cc common.cc list.cc raster.cc scene.cc +OBJS = $(SRCS:%.cc=%.o) +DEPS = $(OBJS:%.o=%.d) +PROG = $(PROJECT)$(EXEEXT) -all: $(PROJECT) +all: $(PROG) -$(PROJECT): $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) +$(PROG): $(OBJS) + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) clean: - rm -f $(PROJECT) $(OBJS) $(DEPS) + rm -f $(PROG) $(OBJS) $(DEPS) distclean: clean - rm -f tags gmon.out scene.ppm scene.bmp + rm -f tags gmon.out + +realclean: distclean + rm -rf frames $(PROJECT).zip dist: - git archive $(PROJECT) --prefix=$(PROJECT)/ --output=$(PROJECT).zip + git archive HEAD --prefix=$(PROJECT)/ --output=$(PROJECT).zip -run: $(PROJECT) - ./$< && $(VIEWER) scene.ppm +run: $(PROG) + ./$< -debug: $(PROJECT) +debug: $(PROG) gdb ./$< -include $(DEPS) $(OBJS): Makefile -.PHONY: all clean distclean run debug +.PHONY: all clean distclean dist run debug