Hi,
I export my mBed project and use an offline toolcahin (Code Sourcery and Eclipse) to edit and compile my project. Works well.
My project has a main file (main.cpp) and a serial communication module that is defined and implemented in a COMfunc.h file.
However,calling <b>make<\b> does not rebuild the project unless I change the main.cpp file. In another words, when I change the COMfunc.h file only, the makefile does not detect the file changes and not rebuild the project.
I think this is due to the header file dependency which has been disscussed in general GCC makefile.
See
http://scottmcpeak.com/autodepend/autodepend.html
and
http://stackoverflow.com/questions/2394609/makefile-header-dependencies
I update the makefile a bit as suggested by http://stackoverflow.com/questions/2394609/makefile-header-dependencies
But it still not work. I am not familiar with the makefile, any suggestions are greatly appreciated.
The part of the makefile I have modified is:
# I add the depend. as suggested by
# http://stackoverflow.com/questions/2394609/makefile-header-dependencies
#
SRC=./COMfunc.h
depend: .depend
.depend: $(SRC)
rm -f ./.depend
all: $(PROJECT).bin
clean:
rm -f $(PROJECT).bin $(PROJECT).elf $(OBJECTS)
.s.o:
$(AS) $(CC_FLAGS) $(CC_SYMBOLS) -o $@ $<
.c.o:
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) $(ONLY_C_FLAGS) $(INCLUDE_PATHS) -o $@ $<
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) $(ONLY_C_FLAGS) $(INCLUDE_PATHS) -MM -> $@ ./.depend
include .depend
.cpp.o:
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) $(ONLY_CPP_FLAGS) $(INCLUDE_PATHS) -o $@ $<
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
# copy the binary output *.elf to mBed MBEDDRIVE\*.bin
# so that no manually copy *.bin to mBed is required.
# Press 'RESET' at mBed to start executing the program
$(PROJECT).bin: $(PROJECT).elf
$(OBJCOPY) -O binary $< $(MBEDDRIVE)\$@
Hi,
I export my mBed project and use an offline toolcahin (Code Sourcery and Eclipse) to edit and compile my project. Works well.
My project has a main file (main.cpp) and a serial communication module that is defined and implemented in a COMfunc.h file.
However,calling <b>make<\b> does not rebuild the project unless I change the main.cpp file. In another words, when I change the COMfunc.h file only, the makefile does not detect the file changes and not rebuild the project.
I think this is due to the header file dependency which has been disscussed in general GCC makefile. See http://scottmcpeak.com/autodepend/autodepend.html and http://stackoverflow.com/questions/2394609/makefile-header-dependencies
I update the makefile a bit as suggested by http://stackoverflow.com/questions/2394609/makefile-header-dependencies
But it still not work. I am not familiar with the makefile, any suggestions are greatly appreciated.
The part of the makefile I have modified is: