SHARE
TWEET

Untitled

a guest Aug 13th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. OLD_SHELL := $(SHELL)
  2. SHELL = $(warning Building $@$(if $^, (from $^))$(if $?, ($? newer)))$(OLD_SHELL)
  3.  
  4. PROJ_DIR  = ..
  5. SRC_DIR   = $(PROJ_DIR)/src
  6. BUILD_DIR = $(PROJ_DIR)/build
  7. LIB_SOURCES =   $(wildcard $(SRC_DIR)/*.cpp)
  8.  
  9. OBJS=$(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(LIB_SOURCES) )
  10.  
  11. CXX=mpicxx
  12.  
  13. DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
  14.  
  15. .SUFFIXES:
  16.  
  17. all: $(OBJS)
  18.  
  19. clean:
  20.     rm $(BUILD_DIR)/*.o
  21.  
  22. $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
  23.     $(CXX) $(DEPFLAGS) -c $< -o $@
  24.  
  25. #define SOURCE_TEMPLATE
  26. #$$(BUILD_DIR)/$$(shell $$(CXX) -MM $(1))
  27. #endef
  28. #$(foreach SRC,$(LIB_SOURCES),$(eval $(call SOURCE_TEMPLATE,$(SRC))))
RAW Paste Data
Top