diff --git a/Makefile b/Makefile index 268b3c40b94d815ad1745ca6e2aab0d287d38f7c..25aed4fba44dc04cc6135957bdf4ef990126420b 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,9 @@ ## Makefile for mxgui ## This makefile builds libmxgui.a ## -MAKEFILE_VERSION := 1.07 +MAKEFILE_VERSION := 1.09 +GCCMAJOR := $(shell arm-miosix-eabi-gcc --version | \ + perl -e '$$_=<>;/\(GCC\) (\d+)/;print "$$1"') ## KPATH and CONFPATH are forwarded by the parent Makefile include $(CONFPATH)/config/Makefile.inc diff --git a/_examples/benchmark/Makefile b/_examples/benchmark/Makefile index 9cad69363a4e9e42e7b634ab7bca6db93a7249df..389868fd14176693a4d8aec3da766ac14b59df01 100644 --- a/_examples/benchmark/Makefile +++ b/_examples/benchmark/Makefile @@ -1,7 +1,9 @@ ## ## Makefile for Miosix embedded OS ## -MAKEFILE_VERSION := 1.04 +MAKEFILE_VERSION := 1.09 +GCCMAJOR := $(shell arm-miosix-eabi-gcc --version | \ + perl -e '$$_=<>;/\(GCC\) (\d+)/;print "$$1"') ## Path to kernel directory (edited by init_project_out_of_git_repo.pl) KPATH := miosix ## Path to config directory (edited by init_project_out_of_git_repo.pl) @@ -33,6 +35,14 @@ INCLUDE_DIRS := -Imxgui ## You should not need to modify anything below ## ############################################################################## +ifeq ("$(VERBOSE)","1") +Q := +ECHO := @true +else +Q := @ +ECHO := @echo +endif + ## Replaces both "foo.cpp"-->"foo.o" and "foo.c"-->"foo.o" OBJ := $(addsuffix .o, $(basename $(SRC))) @@ -48,8 +58,14 @@ AFLAGS := $(AFLAGS_BASE) LFLAGS := $(LFLAGS_BASE) DFLAGS := -MMD -MP -LINK_LIBS := $(LIBS) -L$(KPATH) -Wl,--start-group -lmiosix -lstdc++ -lc \ - -lm -lgcc -Wl,--end-group +## libmiosix.a is among stdlibs because needs to be within start/end group +STDLIBS := -lmiosix -lstdc++ -lc -lm -lgcc + +ifneq ($(GCCMAJOR),4) + STDLIBS += -latomic +endif + +LINK_LIBS := $(LIBS) -L$(KPATH) -Wl,--start-group $(STDLIBS) -Wl,--end-group all: all-recursive main @@ -74,22 +90,27 @@ clean-topdir: -rm -f $(OBJ) main.elf main.hex main.bin main.map $(OBJ:.o=.d) main: main.elf - $(CP) -O ihex main.elf main.hex - $(CP) -O binary main.elf main.bin - $(SZ) main.elf + $(ECHO) "[CP ] main.hex" + $(Q)$(CP) -O ihex main.elf main.hex + $(ECHO) "[CP ] main.bin" + $(Q)$(CP) -O binary main.elf main.bin + $(Q)$(SZ) main.elf main.elf: $(OBJ) all-recursive - @ echo "linking" - $(CXX) $(LFLAGS) -o main.elf $(OBJ) $(KPATH)/$(BOOT_FILE) $(LINK_LIBS) + $(ECHO) "[LD ] main.elf" + $(Q)$(CXX) $(LFLAGS) -o main.elf $(OBJ) $(KPATH)/$(BOOT_FILE) $(LINK_LIBS) %.o: %.s - $(AS) $(AFLAGS) $< -o $@ + $(ECHO) "[AS ] $<" + $(Q)$(AS) $(AFLAGS) $< -o $@ %.o : %.c - $(CC) $(DFLAGS) $(CFLAGS) $< -o $@ + $(ECHO) "[CC ] $<" + $(Q)$(CC) $(DFLAGS) $(CFLAGS) $< -o $@ %.o : %.cpp - $(CXX) $(DFLAGS) $(CXXFLAGS) $< -o $@ + $(ECHO) "[CXX ] $<" + $(Q)$(CXX) $(DFLAGS) $(CXXFLAGS) $< -o $@ #pull in dependecy info for existing .o files -include $(OBJ:.o=.d)