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 <kaapeli@itanic.dy.fi>
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 $@
$(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