cs-3013-assignment-3/Makefile

26 lines
479 B
Makefile

CC = gcc
CFLAGS = -Wall -g -c -std=gnu11
LDFLAGS = -pthread
BUILD_DIR = build
BINARY_NAME = mailbox
OBJ_FILES = $(patsubst %.c,$(BUILD_DIR)/%.o,$(wildcard *.c))
HEADER_FILES = $(wildcard *.h)
.PHONY: all clean
all: $(BINARY_NAME)
clean:
rm -rf $(BUILD_DIR)
$(BINARY_NAME): $(OBJ_FILES) $(HEADER_FILES)
$(CC) -o $(BINARY_NAME) $(filter $(OBJ_FILES),$^) $(LDFLAGS)
$(BUILD_DIR)/%.o: %.c | $(BUILD_DIR)
$(CC) $(CFLAGS) -o $@ $<
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
%.h: ;