From 9d933672fabcd5d81373e954595bce6821007a3b Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Sat, 3 Apr 2010 14:12:24 +0300 Subject: [PATCH] Makefie: Add debug target This makes debugging with gdb easier, when there is no need to modify the makefile in order to disable optimizations while debugging. Signed-off-by: Timo Kokkonen --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f0f3977..8649823 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,14 @@ SPARSE=sparse CHECKPATCH=/usr/src/linux/scripts/checkpatch.pl PLANET_OBJS=main.o random.o vector.o planet.o camera.o +PLANET_DEBUG_OBJS= $(patsubst %.o,%-debug.o,$(PLANET_OBJS)) sdl-planet: $(PLANET_OBJS) gcc $(LIBS) -o $@ $(PLANET_OBJS) +debug-planets: $(PLANET_DEBUG_OBJS) + gcc $(LIBS) -o $@ $(PLANET_DEBUG_OBJS) + .c.o: @echo -e "\tCC\t" $@ @$(CC) -MMD -MF .$@.d $(CFLAGS) -c $< -o $@ @@ -23,12 +27,16 @@ ifeq ($(C),2) $(CHECKPATCH) -f $< endif +%-debug.o: %.c + @echo -e "\tCC\t" $@ + @$(CC) -MMD -MF .$@.d $(CFLAGS) -O0 -c $< -o $@ + TAGS: @echo -e "\tTAGS\t" @etags *.[ch] clean: - rm -rfv $(PLANET_OBJS) *~ sdl-planet TAGS .*.d + rm -rfv $(PLANET_OBJS) $(PLANET_DEBUG_OBJS) *~ sdl-planet TAGS .*.d .PHONY: all clean TAGS -- 2.44.0