Browse Source

Improve Makefile (no unneeded recompilation of executables)

master
J.-S. Caux 2 years ago
parent
commit
4af687fb03
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      Makefile

+ 6
- 5
Makefile View File

@@ -62,12 +62,15 @@ OBJECTS = $(patsubst %.$(SRC_EXT), $(OBJ_DIR)/%.o, $(notdir $(SOURCES)))
62 62
 # Executables
63 63
 EXECUTABLES = $(patsubst %.$(SRC_EXT), $(BIN_DIR)/%, $(notdir $(SOURCES_EXECS)))
64 64
 
65
+# Executables (parallel)
66
+EXECUTABLES_PAR = $(patsubst %.$(SRC_EXT), $(BIN_DIR)/%, $(notdir $(SOURCES_EXECS_PAR)))
67
+
65 68
 
66 69
 # Main target: all executables (and thus the library, and thus all objects)
67 70
 all: $(EXECUTABLES)
68 71
 
69 72
 # Build executables
70
-$(EXECUTABLES): $(BIN_DIR)/%: $(SRC_DIR)/EXECS/%.$(SRC_EXT) lib$(VERSION).a
73
+$(EXECUTABLES): $(BIN_DIR)/%: $(SRC_DIR)/EXECS/%.$(SRC_EXT) $(LIB_DIR)/lib$(VERSION).a
71 74
 	$(COMPILE) $< -o $@ -l$(VERSION)
72 75
 
73 76
 # Compile all object files
@@ -75,10 +78,8 @@ $(OBJ_DIR)/%.o: %.$(SRC_EXT)
75 78
 	$(COMPILE) -c $< -o $@
76 79
 
77 80
 # Create the ABACUS library
78
-lib$(VERSION).a : $(OBJECTS)
79
-	ar -cr lib$(VERSION).a $(OBJECTS)
80
-	mv lib$(VERSION).a $(LIB_DIR)/
81
-
81
+$(LIB_DIR)/lib$(VERSION).a : $(OBJECTS)
82
+	ar -cr $(LIB_DIR)/lib$(VERSION).a $(OBJECTS)
82 83
 
83 84
 ###########################################
84 85
 # Cleanup

Loading…
Cancel
Save