-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
39 lines (29 loc) · 823 Bytes
/
makefile
File metadata and controls
39 lines (29 loc) · 823 Bytes
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
# this "makefile" is for getdiff (download differs) program. It is to be
# placed in the root directory along with src and myinclude directories.
# getdiff/
# |--src/
# |--myinclude/
# |--makefile
#
# This program requires "libcurl" to be installed in the system.
# Run make from the root directory, it will build "getdiff" executable there.
SRC_DIR := src
OBJ_DIR := obj
DST_DIR := .
EXEC := $(DST_DIR)/getdiff
SRC := $(wildcard $(SRC_DIR)/*.c)
OBJ := $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
CPPFLAGS := -Imyinclude -MMD -MP
CFLAGS := -Wall -g
LDLIBS := -lcurl
.PHONY: all clean
all : $(EXEC)
$(EXEC) : $(OBJ)
$(CC) $^ $(LDLIBS) -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(OBJ_DIR) :
mkdir -p $@
clean:
@$(RM) -rv $(OBJ_DIR) $(EXEC)
-include $(OBJ:.o=.d)