cs-3516-assignment-1/Makefile

28 lines
635 B
Makefile
Raw Normal View History

2018-08-27 14:30:27 +00:00
CC = gcc
CFLAGS = -Wall -g -c -std=gnu99
LDFLAGS =
BUILD_DIR = build
COMMON_OBJ_FILES = $(patsubst %.c,$(BUILD_DIR)/%.o,$(wildcard common/*.c))
CLIENT_OBJ_FILES = $(patsubst %.c,$(BUILD_DIR)/%.o,$(wildcard client/*.c))
.PHONY: clean
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),$^)
$(BUILD_DIR)/%.o: %.c
$(CC) $(CFLAGS) -o $@ $<
$(BUILD_DIR)/client:
mkdir -p $(BUILD_DIR)/client
$(BUILD_DIR)/common:
mkdir -p $(BUILD_DIR)/common
$(BUILD_DIR): $(BUILD_DIR)/client $(BUILD_DIR)/common
-mkdir -p $(BUILD_DIR)