make sure we define extruders before endstops for obscure reasons
[clinton/Smoothieware.git] / build / common.mk
index 0419301..6599646 100755 (executable)
@@ -96,18 +96,32 @@ ASRCS =  $(wildcard $(SRC)/*.S $(SRC)/*/*.S $(SRC)/*/*/*.S $(SRC)/*/*/*/*.S $(SR
 ifneq "$(OS)" "Windows_NT"
 ASRCS +=  $(wildcard $(SRC)/*.s $(SRC)/*/*.s $(SRC)/*/*/*.s $(SRC)/*/*/*/*.s $(SRC)/*/*/*/*/*.s)
 endif
+
 CPPSRCS1 = $(wildcard $(SRC)/*.cpp $(SRC)/*/*.cpp $(SRC)/*/*/*.cpp $(SRC)/*/*/*/*.cpp $(SRC)/*/*/*/*/*.cpp $(SRC)/*/*/*/*/*/*.cpp)
 ifeq "$(NONETWORK)" "1"
-CPPSRCS2 = $(filter-out $(SRC)/libs/Network/%,$(CPPSRCS1))
+       CPPSRCS2 = $(filter-out $(SRC)/libs/Network/%,$(CPPSRCS1))
+else
+       ifneq "$(PLAN9)" "1"
+               DEFINES += -DNOPLAN9
+               CPPSRCS2 = $(filter-out $(SRC)/libs/Network/uip/plan9/%,$(CPPSRCS1))
+       else
+               CPPSRCS2 = $(CPPSRCS1)
+       endif
+endif
+
+# CNC build
+ifeq "$(CNC)" "1"
+       CPPSRCS21 = $(filter-out $(SRC)/modules/utils/panel/screens/3dprinter/%,$(CPPSRCS2))
+       DEFINES += -DCNC
 else
-CPPSRCS2 = $(CPPSRCS1)
+       CPPSRCS21 = $(filter-out $(SRC)/modules/utils/panel/screens/cnc/%,$(CPPSRCS2))
 endif
 
 # Totally exclude any modules listed in EXCLUDE_MODULES
 # uppercase function
 uc = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
 EXL = $(patsubst %,$(SRC)/modules/%/%,$(EXCLUDED_MODULES))
-CPPSRCS3 = $(filter-out $(EXL),$(CPPSRCS2))
+CPPSRCS3 = $(filter-out $(EXL),$(CPPSRCS21))
 DEFINES += $(call uc, $(subst /,_,$(patsubst %,-DNO_%,$(EXCLUDED_MODULES))))
 
 # do not compile the src/testframework as that can only be done with rake
@@ -132,7 +146,7 @@ MBED_DIR = $(BUILD_DIR)/../mbed/drop
 MRI_DIR  = $(BUILD_DIR)/../mri
 
 # Include path which points to external library headers and to subdirectories of this project which contain headers.
-SUBDIRS = $(wildcard $(SRC)/* $(SRC)/*/* $(SRC)/*/*/* $(SRC)/*/*/*/* $(SRC)/*/*/*/*/*)
+SUBDIRS = $(wildcard $(SRC)/* $(SRC)/*/* $(SRC)/*/*/* $(SRC)/*/*/*/* $(SRC)/*/*/*/*/* $(SRC)/*/*/*/*/*/*)
 PROJINCS = $(sort $(dir $(SUBDIRS)))
 INCDIRS += $(SRC) $(PROJINCS) $(MRI_DIR) $(MBED_DIR) $(MBED_DIR)/$(DEVICE)
 
@@ -148,7 +162,8 @@ endif
 
 # Libraries to be linked into final binary
 MBED_LIBS = $(MBED_DIR)/$(DEVICE)/GCC_ARM/libmbed.a
-SYS_LIBS = -lstdc++_s -lsupc++_s -lm -lgcc -lc_s -lgcc -lc_s -lnosys
+#SYS_LIBS = -lstdc++_s -lsupc++_s -lm -lgcc -lc_s -lgcc -lc_s -lnosys
+SYS_LIBS = -specs=nano.specs -lstdc++ -lsupc++ -lm -lgcc -lc -lnosys
 LIBS = $(LIBS_PREFIX)
 
 ifeq "$(MRI_ENABLE)" "1"
@@ -268,7 +283,7 @@ size: $(OUTDIR)/$(PROJECT).elf
 
 clean:
        @echo Cleaning up all build generated files
-       $(Q) $(REMOVE_DIR) $(OUTDIR) $(QUIET)
+       $(Q) $(REMOVE_DIR) $(call convert-slash,$(OUTDIR)) $(QUIET)
 
 -include $(DEPFILES)