-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (34 loc) · 1.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
SRC_DIR := src
BUILD_DIR := build
INCLUDE_DIR := include
TARGET := simple-ls
OBJS := util file-info
TESTS := util-test file-info-test
CC := gcc
CFLAGS := -g -Wall -Werror -std=c11
IFLAGS := -I ./include
all: $(OBJS) $(TARGET)
tests: $(TESTS)
$(TARGET):
@echo "Building $@ ...";
@mkdir -p $(BUILD_DIR)
@$(CC) $(CFLAGS) $(IFLAGS) -o $(BUILD_DIR)/$(TARGET) $(BUILD_DIR)/file-info.o $(BUILD_DIR)/util.o $(SRC_DIR)/main.c
util:
@echo "Building $@ ...";
@mkdir -p $(BUILD_DIR)
@$(CC) $(CFLAGS) $(IFLAGS) -c -o $(BUILD_DIR)/[email protected] $(SRC_DIR)/[email protected]
file-info:
@echo "Building $@ ...";
@mkdir -p $(BUILD_DIR)
@$(CC) $(CFLAGS) $(IFLAGS) -c -o $(BUILD_DIR)/[email protected] $(SRC_DIR)/[email protected]
util-test:
@mkdir -p $(BUILD_DIR)/tests
@echo "Building $@ ...";
@$(CC) $(CFLAGS) $(IFLAGS) -o $(BUILD_DIR)/tests/$@ tests/[email protected] $(BUILD_DIR)/util.o -lcmocka
file-info-test:
@mkdir -p $(BUILD_DIR)/tests
@echo "Building $@ ...";
@$(CC) $(CFLAGS) $(IFLAGS) -o $(BUILD_DIR)/tests/$@ tests/[email protected] $(BUILD_DIR)/file-info.o $(BUILD_DIR)/util.o -lcmocka
clean:
@echo "Cleaning $(BUILD_DIR) ...";
@rm -Rf $(BUILD_DIR)