Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 645c272

Browse files
committedOct 2, 2010
Move build intermediate files into a subdir
The root dir was getting hairy, so this moves build files into the build directory. This also reduces the chance of build errors with any other projects sharing the lufa library. Signed-off-by: Vernon Mauery <vernon@mauery.com>
1 parent 09c9f2b commit 645c272

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
build/
12
tmp/
23
doc/
34
lufa

‎Makefile

+8-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ BUILD_TYPE = debug
9191
# Object files directory
9292
# To put object files in current directory, use a dot (.), do NOT make
9393
# this an empty or blank macro!
94-
OBJDIR = .
94+
OBJDIR = build
9595

9696

9797
# Path to the LUFA library
@@ -114,6 +114,7 @@ SRC = $(TARGET).c \
114114
ringbuffer.c \
115115
sprintf.c \
116116
descriptors.c \
117+
settings.sig.h \
117118
settings.c \
118119
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Device.c \
119120
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
@@ -453,7 +454,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
453454

454455

455456
# Default target.
456-
all: begin settings.sig.h gccversion sizebefore build sizeafter end
457+
all: begin gccversion builddirs sizebefore build sizeafter end
457458

458459
# Change the build target to build a HEX file or a library.
459460
build: elf hex eep list sym
@@ -488,6 +489,9 @@ ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
488489
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
489490
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
490491

492+
builddirs:
493+
@-mkdir -p $(foreach D, $(OBJ), \
494+
$(shell dirname $(D)) )
491495

492496
sizebefore:
493497
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
@@ -680,7 +684,7 @@ clean_list :
680684
$(REMOVE) $(TARGET).map
681685
$(REMOVE) $(TARGET).sym
682686
$(REMOVE) $(TARGET).list
683-
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) settings.sig.h
687+
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
684688
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
685689
$(REMOVE) $(SRC:.c=.s)
686690
$(REMOVE) $(SRC:.c=.d)
@@ -707,4 +711,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
707711
.PHONY : all begin finish end sizebefore sizeafter gccversion \
708712
build elf hex eep list sym coff extcoff doxygen clean \
709713
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
710-
debug gdb-config
714+
debug gdb-config builddirs

0 commit comments

Comments
 (0)
Please sign in to comment.