Improve Makefile (no unneeded recompilation of executables)
This commit is contained in:
@@ -62,12 +62,15 @@ OBJECTS = $(patsubst %.$(SRC_EXT), $(OBJ_DIR)/%.o, $(notdir $(SOURCES)))
|
|||||||
# Executables
|
# Executables
|
||||||
EXECUTABLES = $(patsubst %.$(SRC_EXT), $(BIN_DIR)/%, $(notdir $(SOURCES_EXECS)))
|
EXECUTABLES = $(patsubst %.$(SRC_EXT), $(BIN_DIR)/%, $(notdir $(SOURCES_EXECS)))
|
||||||
|
|
||||||
|
# Executables (parallel)
|
||||||
|
EXECUTABLES_PAR = $(patsubst %.$(SRC_EXT), $(BIN_DIR)/%, $(notdir $(SOURCES_EXECS_PAR)))
|
||||||
|
|
||||||
|
|
||||||
# Main target: all executables (and thus the library, and thus all objects)
|
# Main target: all executables (and thus the library, and thus all objects)
|
||||||
all: $(EXECUTABLES)
|
all: $(EXECUTABLES)
|
||||||
|
|
||||||
# Build executables
|
# Build executables
|
||||||
$(EXECUTABLES): $(BIN_DIR)/%: $(SRC_DIR)/EXECS/%.$(SRC_EXT) lib$(VERSION).a
|
$(EXECUTABLES): $(BIN_DIR)/%: $(SRC_DIR)/EXECS/%.$(SRC_EXT) $(LIB_DIR)/lib$(VERSION).a
|
||||||
$(COMPILE) $< -o $@ -l$(VERSION)
|
$(COMPILE) $< -o $@ -l$(VERSION)
|
||||||
|
|
||||||
# Compile all object files
|
# Compile all object files
|
||||||
@@ -75,10 +78,8 @@ $(OBJ_DIR)/%.o: %.$(SRC_EXT)
|
|||||||
$(COMPILE) -c $< -o $@
|
$(COMPILE) -c $< -o $@
|
||||||
|
|
||||||
# Create the ABACUS library
|
# Create the ABACUS library
|
||||||
lib$(VERSION).a : $(OBJECTS)
|
$(LIB_DIR)/lib$(VERSION).a : $(OBJECTS)
|
||||||
ar -cr lib$(VERSION).a $(OBJECTS)
|
ar -cr $(LIB_DIR)/lib$(VERSION).a $(OBJECTS)
|
||||||
mv lib$(VERSION).a $(LIB_DIR)/
|
|
||||||
|
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user