From 4118d8c0318e69b366d424545cbad6529bfc5e53 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 23 May 2002 11:46:15 +0000 Subject: attempted OBJDIR support git-svn-id: svn://svn.rockbox.org/rockbox/trunk@663 a1c6a512-1295-4272-9138-f99709370657 --- firmware/Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/firmware/Makefile b/firmware/Makefile index d9670222b4..cb18c393d4 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -20,6 +20,9 @@ TARGET = -DARCHOS_PLAYER=1 #TARGET = -DARCHOS_PLAYER_OLD=1 #TARGET = -DARCHOS_RECORDER=1 +# store output files in this directory: +OBJDIR = . + CFLAGS = -W -Wall -O -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET) ifdef DEBUG @@ -32,26 +35,28 @@ AFLAGS += -small -relax SRC := $(wildcard drivers/*.c common/*.c malloc/*.c *.c) -OBJS := $(SRC:%.c=%.o) crt0.o +OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(OBJDIR)/crt0.o DEPS:=.deps DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common $(DEPS)/malloc -librockbox.a: $(OBJS) +OUTPUT = $(OBJDIR)/librockbox.a + +$(OUTPUT): $(OBJS) $(AR) ruv $@ $+ clean: - -rm -f $(OBJS) *.x *.i *.o *.elf *.bin *.map *.mod *.bak *~ + -$(RM) -f $(OBJDIR)/$(OBJS) *~ $(OUTPUT) -$(RM) -r $(DEPS) # Special targets -thread.o: thread.c thread.h - $(CC) -c -O -fomit-frame-pointer $(CFLAGS) $< +$(OBJDIR)/thread.o: thread.c thread.h + $(CC) -c -O -fomit-frame-pointer $(CFLAGS) $< -o $@ $(DEPS)/%.d: %.c @$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $$d ]; then mkdir $$d; fi; }; done' @echo "Updating dependencies for $<" @$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \ - |sed '\''s|\($*\)\.o[ :]*|\1.o $(<:%.c=%.d) : |g'\'' > $@; \ + |sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \ [ -s $@ ] || rm -f $@' -include $(SRC:%.c=$(DEPS)/%.d) -- cgit v1.2.3