Refactor handling of build directories in Makefile
parent
83b764eb28
commit
fccf0db890
18
Makefile
18
Makefile
|
@ -14,23 +14,23 @@ clean:
|
|||
rm -rf $(BUILD_DIR)
|
||||
rm -f http_client
|
||||
|
||||
http_client: $(BUILD_DIR) $(COMMON_OBJ_FILES) $(CLIENT_OBJ_FILES)
|
||||
$(CC) -o $@ $(LDFLAGS) $(filter-out $(BUILD_DIR),$^)
|
||||
http_client: $(BUILD_DIR)/client $(BUILD_DIR)/common $(COMMON_OBJ_FILES) $(CLIENT_OBJ_FILES)
|
||||
$(CC) -o $@ $(LDFLAGS) $(filter-out $(BUILD_DIR)/common $(BUILD_DIR)/client,$^)
|
||||
|
||||
http_server: $(BUILD_DIR) $(COMMON_OBJ_FILES) $(SERVER_OBJ_FILES)
|
||||
$(CC) -o $@ $(LDFLAGS) $(filter-out $(BUILD_DIR),$^)
|
||||
http_server: $(BUILD_DIR)/server $(BUILD_DIR)/common $(COMMON_OBJ_FILES) $(SERVER_OBJ_FILES)
|
||||
$(CC) -o $@ $(LDFLAGS) $(filter-out $(BUILD_DIR)/common $(BUILD_DIR)/server,$^)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/server:
|
||||
$(BUILD_DIR)/server: $(BUILD_DIR)
|
||||
mkdir -p $(BUILD_DIR)/server
|
||||
|
||||
$(BUILD_DIR)/client:
|
||||
$(BUILD_DIR)/client: $(BUILD_DIR)
|
||||
mkdir -p $(BUILD_DIR)/client
|
||||
|
||||
$(BUILD_DIR)/common:
|
||||
$(BUILD_DIR)/common: $(BUILD_DIR)
|
||||
mkdir -p $(BUILD_DIR)/common
|
||||
|
||||
$(BUILD_DIR): $(BUILD_DIR)/client $(BUILD_DIR)/common
|
||||
-mkdir -p $(BUILD_DIR)
|
||||
$(BUILD_DIR):
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
|
Loading…
Reference in New Issue