diff --git a/newlib/examples/Makefile b/newlib/examples/Makefile index 6eaa1af8..5e712ac1 100644 --- a/newlib/examples/Makefile +++ b/newlib/examples/Makefile @@ -2,8 +2,11 @@ ARCH = x86 NEWLIB = ../x86/i586-metalsvm-elf32 MAKE = make CC = gcc -CFLAGS = -m32 -O2 -nostdinc -Wall -fno-builtin -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include -fno-stack-protector +CFLAGS = -g -m32 -O2 -nostdinc -Wall -fno-builtin -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include -fno-stack-protector LDFLAGS = -m32 -nostdlib -L$(NEWLIB)/lib +OBJCOPY = objcopy +STRIP_DEBUG = --strip-debug +KEEP_DEBUG = --only-keep-debug # other implicit rules %.o : %.c @@ -15,12 +18,16 @@ all: hello test_fork test_fork: test_fork.o $(CC) -T link.ld -o $@ $(LDFLAGS) $< + $(OBJCOPY) $(KEEP_DEBUG) $@ $@.sym + $(OBJCOPY) $(STRIP_DEBUG) $@ hello: hello.o $(CC) -T link.ld -o $@ $(LDFLAGS) $< + $(OBJCOPY) $(KEEP_DEBUG) $@ $@.sym + $(OBJCOPY) $(STRIP_DEBUG) $@ clean: - $(RM) hello test_fork *.o *~ + $(RM) hello test_fork *.sym *.o *~ depend: $(CC) -MM $(CFLAGS) *.c > Makefile.dep