cs-3013-assignment-3/Makefile

26 lines
479 B
Makefile
Raw Normal View History

2019-09-21 22:53:19 +00:00
CC = gcc
CFLAGS = -Wall -g -c -std=gnu11
2019-09-21 23:35:42 +00:00
LDFLAGS = -pthread
2019-09-21 22:53:19 +00:00
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: ;