Merge pull request #279 from pabigot/push/make-clean-all

Add support for subdirectories in CLEAN and for "make clean all"
This commit is contained in:
Oliver Schmidt 2013-06-21 02:47:19 -07:00
commit f06ee95883
15 changed files with 59 additions and 50 deletions

View File

@ -86,6 +86,10 @@ CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFI
PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}} PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}}
# Provide way to create $(OBJECTDIR) if it has been removed by make clean
$(OBJECTDIR):
mkdir $@
### Include application makefiles ### Include application makefiles
ifdef APPS ifdef APPS
@ -108,9 +112,6 @@ target_makefile := $(wildcard $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET) $
ifeq ($(strip $(target_makefile)),) ifeq ($(strip $(target_makefile)),)
${error The target platform "$(TARGET)" does not exist (maybe it was misspelled?)} ${error The target platform "$(TARGET)" does not exist (maybe it was misspelled?)}
else else
ifeq (${wildcard $(OBJECTDIR)},)
DUMMY := ${shell mkdir $(OBJECTDIR)}
endif
ifneq (1, ${words $(target_makefile)}) ifneq (1, ${words $(target_makefile)})
${error More than one TARGET Makefile found: $(target_makefile)} ${error More than one TARGET Makefile found: $(target_makefile)}
endif endif
@ -175,11 +176,12 @@ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
rm -f $(@:.o=.$$$$) rm -f $(@:.o=.$$$$)
endef endef
clean: clean:
rm -f *~ *core core *.srec \ rm -f *~ *core core *.srec \
*.lst *.map \ *.lst *.map \
*.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \ *.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \
*.ce *.co $(CLEAN) *.ce *.co
rm -rf $(CLEAN)
-rm -rf $(OBJECTDIR) -rm -rf $(OBJECTDIR)
ifndef CUSTOM_RULE_C_TO_CE ifndef CUSTOM_RULE_C_TO_CE
@ -189,13 +191,13 @@ ifndef CUSTOM_RULE_C_TO_CE
endif endif
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) $(CFLAGS) -MMD -c $< -o $@ $(CC) $(CFLAGS) -MMD -c $< -o $@
@$(FINALIZE_DEPENDENCY) @$(FINALIZE_DEPENDENCY)
endif endif
ifndef CUSTOM_RULE_S_TO_OBJECTDIR_O ifndef CUSTOM_RULE_S_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.S $(OBJECTDIR)/%.o: %.S | $(OBJECTDIR)
$(AS) $(ASFLAGS) -o $@ $< $(AS) $(ASFLAGS) -o $@ $<
endif endif

View File

@ -73,7 +73,7 @@ AROPTS = a
.SUFFIXES: .SUFFIXES:
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) -c -o $@ $(CFLAGS) --create-dep $(@:.o=.d) $< $(CC) -c -o $@ $(CFLAGS) --create-dep $(@:.o=.d) $<
CUSTOM_RULE_C_TO_CO = 1 CUSTOM_RULE_C_TO_CO = 1

View File

@ -95,29 +95,29 @@ CUSTOM_RULE_C_TO_O=yes
%-interrupt.o: %-interrupt.c %-interrupt.o: %-interrupt.c
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c
$(OBJECTDIR)/%-interrupt.o: %-interrupt.c $(OBJECTDIR)/%-interrupt.o: %-interrupt.c | $(OBJECTDIR)
$(CC) $(CFLAGS) $(ARM_FLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(ARM_FLAGS) -c $< -o $@
%-arm.o: %-arm.c %-arm.o: %-arm.c
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c
$(OBJECTDIR)/%-arm.o: %-arm.c $(OBJECTDIR)/%-arm.o: %-arm.c | $(OBJECTDIR)
$(CC) $(CFLAGS) $(ARM_FLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(ARM_FLAGS) -c $< -o $@
$(OBJECTDIR)/interrupt-utils.o: interrupt-utils.c $(OBJECTDIR)/interrupt-utils.o: interrupt-utils.c | $(OBJECTDIR)
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@ $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c $(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@
CUSTOM_RULE_S_TO_OBJECTDIR_O = yes CUSTOM_RULE_S_TO_OBJECTDIR_O = yes
%.o: %.S %.o: %.S
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c
$(OBJECTDIR)/%.o: %.S $(OBJECTDIR)/%.o: %.S | $(OBJECTDIR)
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@ $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
@ -188,7 +188,7 @@ ocd_reset:
cd $(CONTIKI_CPU)/openocd;$(OPENOCD) -f $(OPENOCD_CFG) -c init -c reset -c exit cd $(CONTIKI_CPU)/openocd;$(OPENOCD) -f $(OPENOCD_CFG) -c init -c reset -c exit
# Don't use core/loader/elfloader.c, use elfloader-otf.c instead # Don't use core/loader/elfloader.c, use elfloader-otf.c instead
$(OBJECTDIR)/elfloader.o: $(OBJECTDIR)/elfloader.o: | $(OBJECTDIR)
echo -n >$@ echo -n >$@
clean: clean_cpu clean: clean_cpu

View File

@ -94,7 +94,7 @@ CUSTOM_RULE_C_TO_O=yes
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) $< -c $(CC) $(CFLAGS) $< -c
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
@ -102,7 +102,7 @@ CUSTOM_RULE_S_TO_OBJECTDIR_O = yes
%.o: %.S %.o: %.S
$(CC) $(CFLAGS) $< -c $(CC) $(CFLAGS) $< -c
$(OBJECTDIR)/%.o: %.S $(OBJECTDIR)/%.o: %.S | $(OBJECTDIR)
$(CC) $(CFLAGS) $< -c -o $@ $(CC) $(CFLAGS) $< -c -o $@
@ -175,7 +175,7 @@ ocd_reset:
$(OPENOCD) -s $(OPENOCD_DIR) -f $(OPENOCD_CFG) -c init -c "reset halt;resume" -c exit $(OPENOCD) -s $(OPENOCD_DIR) -f $(OPENOCD_CFG) -c init -c "reset halt;resume" -c exit
# Don't use core/loader/elfloader.c, use elfloader-otf.c instead # Don't use core/loader/elfloader.c, use elfloader-otf.c instead
$(OBJECTDIR)/elfloader.o: $(OBJECTDIR)/elfloader.o: | $(OBJECTDIR)
echo -n >$@ echo -n >$@
clean: clean_cpu clean: clean_cpu

View File

@ -122,7 +122,7 @@ CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
### Compilation rules ### Compilation rules
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
%.o: %.c %.o: %.c

View File

@ -116,7 +116,8 @@ PROJECT_OBJECTFILES = $(addprefix $(OBJECTDIR)/, \
SEGMENT_RULE_FILES = $(foreach dir, . $(CONTIKI_PLATFORM_DIRS) \ SEGMENT_RULE_FILES = $(foreach dir, . $(CONTIKI_PLATFORM_DIRS) \
$(CONTIKI_CPU_DIRS_LIST), $(wildcard $(dir)/segment.rules) ) $(CONTIKI_CPU_DIRS_LIST), $(wildcard $(dir)/segment.rules) )
$(SEGMENT_RULES): $(SEGMENT_RULE_FILES) # NB: Assumes SEGMENT_RULES was not overridden and is in $(OBJECTDIR)
$(SEGMENT_RULES): $(SEGMENT_RULE_FILES) | $(OBJECTDIR)
cat $(SEGMENT_RULE_FILES) | \ cat $(SEGMENT_RULE_FILES) | \
sed -e 's/#.*$$//' -e 's/^\s*//' -e '/^$$/d' > $@ sed -e 's/#.*$$//' -e 's/^\s*//' -e '/^$$/d' > $@
@ -124,11 +125,11 @@ CUSTOM_RULE_LINK=1
CUSTOM_RULE_C_TO_OBJECTDIR_O=1 CUSTOM_RULE_C_TO_OBJECTDIR_O=1
CUSTOM_RULE_ALLOBJS_TO_TARGETLIB=1 CUSTOM_RULE_ALLOBJS_TO_TARGETLIB=1
$(OBJECTDIR)/%.rel: %.c $(SEGMENT_RULES) $(OBJECTDIR)/%.rel: %.c $(SEGMENT_RULES) | $(OBJECTDIR)
$(CC) $(call c_seg,$<,$@) $(CFLAGS) -c $< -o $@ -Wp,-MMD,$(@:.rel=.d),-MQ,$@ $(CC) $(call c_seg,$<,$@) $(CFLAGS) -c $< -o $@ -Wp,-MMD,$(@:.rel=.d),-MQ,$@
@$(FINALIZE_SDCC_DEPENDENCY) @$(FINALIZE_SDCC_DEPENDENCY)
$(OBJECTDIR)/%.rel: %.cS $(OBJECTDIR)/%.rel: %.cS | $(OBJECTDIR)
cp $< $(OBJECTDIR)/$*.c cp $< $(OBJECTDIR)/$*.c
$(CC) $(CFLAGS) -E $(OBJECTDIR)/$*.c > $(OBJECTDIR)/tmp $(CC) $(CFLAGS) -E $(OBJECTDIR)/$*.c > $(OBJECTDIR)/tmp
perl -pe "s/^#(.*)/;$$1/" $(OBJECTDIR)/tmp > $(OBJECTDIR)/$*.S perl -pe "s/^#(.*)/;$$1/" $(OBJECTDIR)/tmp > $(OBJECTDIR)/$*.S
@ -144,7 +145,7 @@ contiki-$(TARGET).lib: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) \
# build app/example local object files. We need a separate rule so that we can # build app/example local object files. We need a separate rule so that we can
# pass -DAUTOSTART_ENABLE for those files only # pass -DAUTOSTART_ENABLE for those files only
$(OBJECTDIR)/%.app.rel: %.c $(SEGMENT_RULES) $(OBJECTDIR)/%.app.rel: %.c $(SEGMENT_RULES) | $(OBJECTDIR)
$(CC) $(call c_seg,$<,$@) -DAUTOSTART_ENABLE $(CFLAGS) -c $< -o $@ $(CC) $(call c_seg,$<,$@) -DAUTOSTART_ENABLE $(CFLAGS) -c $< -o $@
# .ihx is the sdcc binary output file # .ihx is the sdcc binary output file

View File

@ -59,7 +59,7 @@ CONTIKI_SOURCEFILES += $(USB_CORE_SOURCEFILES) $(USB_ARCH_SOURCEFILES)
### Always re-build ieee-addr.o in case the command line passes a new NODEID ### Always re-build ieee-addr.o in case the command line passes a new NODEID
FORCE: FORCE:
$(OBJECTDIR)/ieee-addr.o: ieee-addr.c FORCE $(OBJECTDIR)/ieee-addr.o: ieee-addr.c FORCE | $(OBJECTDIR)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
### Compilation rules ### Compilation rules
@ -82,5 +82,6 @@ LDGENFLAGS += $(addprefix -I,$(SOURCEDIRS))
LDGENFLAGS += -imacros "contiki-conf.h" LDGENFLAGS += -imacros "contiki-conf.h"
LDGENFLAGS += -P -E LDGENFLAGS += -P -E
$(LDSCRIPT): $(CONTIKI_CPU)/cc2538.lds FORCE # NB: Assumes LDSCRIPT was not overridden and is in $(OBJECTDIR)
$(LDSCRIPT): $(CONTIKI_CPU)/cc2538.lds FORCE | $(OBJECTDIR)
$(CPP) $(LDGENFLAGS) $< -o $@ $(CPP) $(LDGENFLAGS) $< -o $@

View File

@ -137,7 +137,8 @@ PROJECT_OBJECTFILES = $(addprefix $(OBJECTDIR)/, \
SEGMENT_RULE_FILES = $(foreach dir, . $(CONTIKI_PLATFORM_DIRS) \ SEGMENT_RULE_FILES = $(foreach dir, . $(CONTIKI_PLATFORM_DIRS) \
$(CONTIKI_CPU_DIRS_LIST), $(wildcard $(dir)/segment.rules) ) $(CONTIKI_CPU_DIRS_LIST), $(wildcard $(dir)/segment.rules) )
$(SEGMENT_RULES): $(SEGMENT_RULE_FILES) # NB: Assumes SEGMENT_RULES was not overridden and is in $(OBJECTDIR)
$(SEGMENT_RULES): $(SEGMENT_RULE_FILES) | $(OBJECTDIR)
cat $(SEGMENT_RULE_FILES) | \ cat $(SEGMENT_RULE_FILES) | \
sed -e 's/#.*$$//' -e 's/^\s*//' -e '/^$$/d' > $@ sed -e 's/#.*$$//' -e 's/^\s*//' -e '/^$$/d' > $@
@ -145,11 +146,11 @@ CUSTOM_RULE_LINK=1
CUSTOM_RULE_C_TO_OBJECTDIR_O=1 CUSTOM_RULE_C_TO_OBJECTDIR_O=1
CUSTOM_RULE_ALLOBJS_TO_TARGETLIB=1 CUSTOM_RULE_ALLOBJS_TO_TARGETLIB=1
$(OBJECTDIR)/%.rel: %.c $(SEGMENT_RULES) $(OBJECTDIR)/%.rel: %.c $(SEGMENT_RULES) | $(OBJECTDIR)
$(CC) $(call c_seg,$<,$@) $(CFLAGS) -c $< -o $@ -Wp,-MMD,$(@:.rel=.d),-MQ,$@ $(CC) $(call c_seg,$<,$@) $(CFLAGS) -c $< -o $@ -Wp,-MMD,$(@:.rel=.d),-MQ,$@
@$(FINALIZE_SDCC_DEPENDENCY) @$(FINALIZE_SDCC_DEPENDENCY)
$(OBJECTDIR)/%.rel: %.cS $(OBJECTDIR)/%.rel: %.cS | $(OBJECTDIR)
cp $< $(OBJECTDIR)/$*.c cp $< $(OBJECTDIR)/$*.c
$(CC) $(CFLAGS) -E $(OBJECTDIR)/$*.c > $(OBJECTDIR)/tmp $(CC) $(CFLAGS) -E $(OBJECTDIR)/$*.c > $(OBJECTDIR)/tmp
perl -pe "s/^#(.*)/;$$1/" $(OBJECTDIR)/tmp > $(OBJECTDIR)/$*.S perl -pe "s/^#(.*)/;$$1/" $(OBJECTDIR)/tmp > $(OBJECTDIR)/$*.S
@ -165,7 +166,7 @@ contiki-$(TARGET).lib: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) \
# build app/example local object files. We need a separate rule so that we can # build app/example local object files. We need a separate rule so that we can
# pass -DAUTOSTART_ENABLE for those files only # pass -DAUTOSTART_ENABLE for those files only
$(OBJECTDIR)/%.app.rel: %.c $(SEGMENT_RULES) $(OBJECTDIR)/%.app.rel: %.c $(SEGMENT_RULES) | $(OBJECTDIR)
$(CC) $(call c_seg,$<,$@) -DAUTOSTART_ENABLE $(CFLAGS) -c $< -o $@ $(CC) $(call c_seg,$<,$@) -DAUTOSTART_ENABLE $(CFLAGS) -c $< -o $@
# .ihx is the sdcc binary output file # .ihx is the sdcc binary output file

View File

@ -73,28 +73,28 @@ CFLAGS += -I$(OBJECTDIR) -I$(CONTIKI_CPU)/board -DBOARD=$(TARGET)
CPPFLAGS += -P -C ${addprefix -D,${subst $(COMMA), ,$(DEFINES)}} CPPFLAGS += -P -C ${addprefix -D,${subst $(COMMA), ,$(DEFINES)}}
$(OBJECTDIR)/board.h: $(OBJECTDIR) $(OBJECTDIR)/board.h: $(CONTIKI_CPU)/board/board.h | $(OBJECTDIR)
ifeq ($(HOST_OS),Windows) ifeq ($(HOST_OS),Windows)
ln -f $(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h ln -f $< $@
else else
ln -sf ../$(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h ln -sf ../$< $@
endif endif
$(OBJECTDIR)/%.lds: $(CONTIKI_CPU)/%.lds.S $(OBJECTDIR)/%.lds: $(CONTIKI_CPU)/%.lds.S | $(OBJECTDIR)
$(CPP) $(CPPFLAGS) $< > $@ $(CPP) $(CPPFLAGS) $< > $@
$(OBJECTDIR)/isr.o: $(CONTIKI_CPU)/src/isr.c $(OBJECTDIR)/isr.o: $(CONTIKI_CPU)/src/isr.c | $(OBJECTDIR)
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@ $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c $(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@
CUSTOM_RULE_S_TO_OBJECTDIR_O = yes CUSTOM_RULE_S_TO_OBJECTDIR_O = yes
$(OBJECTDIR)/%.o: %.S $(OBJECTDIR)/%.o: %.S | $(OBJECTDIR)
$(CC) $(CFLAGS) $(AFLAGS) $(ARM_FLAGS) $< -c -o $@ $(CC) $(CFLAGS) $(AFLAGS) $(ARM_FLAGS) $< -c -o $@
CUSTOM_RULE_C_TO_CO=yes CUSTOM_RULE_C_TO_CO=yes

View File

@ -97,7 +97,7 @@ rm -f $(@:.o=.P)
endef endef
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@ $(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@
ifeq ($(HOST_OS),Windows) ifeq ($(HOST_OS),Windows)
@$(FINALIZE_CYGWIN_DEPENDENCY) @$(FINALIZE_CYGWIN_DEPENDENCY)

View File

@ -216,7 +216,7 @@ endif
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@ $(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@
@$(SEDCOMMAND); rm -f $(@:.o=.P) @$(SEDCOMMAND); rm -f $(@:.o=.P)
@$(FINALIZE_DEPENDENCY) @$(FINALIZE_DEPENDENCY)
@ -270,10 +270,10 @@ stm-motelist:
stm-motes: stm-motes:
@echo $(MOTES) @echo $(MOTES)
$(OBJECTDIR)/%.o: %.s79 $(OBJECTDIR)/%.o: %.s79 | $(OBJECTDIR)
$(AS) $(ASFLAGS) -o $@ $< $(AS) $(ASFLAGS) -o $@ $<
$(OBJECTDIR)/%.o: %.s $(OBJECTDIR)/%.o: %.s | $(OBJECTDIR)
$(AS) $(ASFLAGS) -o $@ $< $(AS) $(ASFLAGS) -o $@ $<
%.bin: %.$(TARGET) %.bin: %.$(TARGET)

View File

@ -56,11 +56,11 @@ CONTIKI_PLATFORM_DIRS = $(PLATFORM_APPDIRS) \
vpath %.cS $(CONTIKI_PLATFORM_DIRS) vpath %.cS $(CONTIKI_PLATFORM_DIRS)
#option -MMD doesn't work well on SDCC as of 2.9.0 #option -MMD doesn't work well on SDCC as of 2.9.0
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
ifndef CUSTOM_RULE_CS_TO_OBJECTDIR_O ifndef CUSTOM_RULE_CS_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.cS $(OBJECTDIR)/%.o: %.cS | $(OBJECTDIR)
cp $< $(OBJECTDIR)/$*.c cp $< $(OBJECTDIR)/$*.c
$(CC) $(CFLAGS) -E $(OBJECTDIR)/$*.c > $(OBJECTDIR)/tmp $(CC) $(CFLAGS) -E $(OBJECTDIR)/$*.c > $(OBJECTDIR)/tmp
perl -pe "s/^#(.*)/;$$1/" $(OBJECTDIR)/tmp > $(OBJECTDIR)/$*.S perl -pe "s/^#(.*)/;$$1/" $(OBJECTDIR)/tmp > $(OBJECTDIR)/$*.S

View File

@ -91,10 +91,13 @@ endif # UIP_CONF_IPV6
REDEF_PRINTF=1 # Redefine functions to enable printf()s inside Cooja REDEF_PRINTF=1 # Redefine functions to enable printf()s inside Cooja
### Define custom targets ### Define custom targets
$(ARCHIVE): ${addprefix $(OBJECTDIR)/, $(CONTIKI_SOURCEFILES:.c=.o)}
# NB: Assumes ARCHIVE was not overridden and is in $(OBJECTDIR)
$(ARCHIVE): ${addprefix $(OBJECTDIR)/, $(CONTIKI_SOURCEFILES:.c=.o)} | $(OBJECTDIR)
$(AR_COMMAND_1) $^ $(AR_COMMAND_2) $(AR_COMMAND_1) $^ $(AR_COMMAND_2)
$(JNILIB): $(CONTIKI_APP_OBJ) $(MAIN_OBJ) $(PROJECT_OBJECTFILES) $(ARCHIVE) # NB: Assumes JNILIB was not overridden and is in $(OBJECTDIR)
$(JNILIB): $(CONTIKI_APP_OBJ) $(MAIN_OBJ) $(PROJECT_OBJECTFILES) $(ARCHIVE) | $(OBJECTDIR)
ifdef SYMBOLS ifdef SYMBOLS
@echo Generating symbols @echo Generating symbols
# Recreate symbols file and relink with final memory layout (twice) # Recreate symbols file and relink with final memory layout (twice)
@ -117,7 +120,9 @@ $(CONTIKI_APP).cooja: $(JNILIB)
cp $(JNILIB) $@ cp $(JNILIB) $@
rm $(CONTIKI_APP_OBJ) rm $(CONTIKI_APP_OBJ)
mtype%.o: contiki-cooja-main.o # Trickiness: GNU make matches this against the file base name.
# Assume that the directory part is the standard location.
mtype%.o: contiki-cooja-main.o | $(OBJECTDIR)
mv contiki-cooja-main.o $@ mv contiki-cooja-main.o $@
symbols.c: symbols.c:

View File

@ -83,7 +83,7 @@ ifdef VCINSTALLDIR
VCFLAGS = -Od -Z7 $(filter-out -Wall -g -O,$(CFLAGS)) VCFLAGS = -Od -Z7 $(filter-out -Wall -g -O,$(CFLAGS))
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
cl -nologo $(VCFLAGS) -c $< -Fo$@ cl -nologo $(VCFLAGS) -c $< -Fo$@
@makedepend $(CFLAGS) -o.o -f- $< 2> nul: | sed -e s!$(<:.c=.o)!$@! -e s!\\!/!g > $(@:.o=.d) @makedepend $(CFLAGS) -o.o -f- $< 2> nul: | sed -e s!$(<:.c=.o)!$@! -e s!\\!/!g > $(@:.o=.d)

View File

@ -14,10 +14,6 @@ OBJECTS = ${addprefix $(OBJECTDIR)/,$(SOURCES:.c=.o)}
vpath %.c $(SOURCEDIR) vpath %.c $(SOURCEDIR)
ifeq (${wildcard $(OBJECTDIR)},)
DUMMY := ${shell mkdir $(OBJECTDIR)}
endif
hexameter: $(OBJECTS) hexameter: $(OBJECTS)
$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(CC) $(CFLAGS) -o $@ $(OBJECTS)
@ -26,6 +22,9 @@ clean:
rm -f *~ *.stackdump rm -f *~ *.stackdump
rm -f *~ hexameter hexameter.exe rm -f *~ hexameter hexameter.exe
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR):
mkdir $@
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@