-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
50 lines (39 loc) · 936 Bytes
/
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
45
46
47
48
49
50
## @file Makefile
#
# Copyright (c) 2014 大前良介 (OHMAE Ryosuke)
#
# This software is released under the MIT License.
# http://opensource.org/licenses/MIT
#
# @breaf
# @author <a href="mailto:[email protected]">大前良介 (OHMAE Ryosuke)</a>
# @date 2015/02/08
CC = gcc
RM = rm -rf
MAKE = make
CFLAGS = -Wall -g3 -O2
COPTS = -D_DEBUG_
LDFLAGS = -lpng -ljpeg
MODULE = image
OBJ_DIR = obj
DEPEND_FILE = $(MODULE).dpd
SRCS = $(wildcard *.c)
OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:%.c=%.o))
.PHONY: all clean
all: $(MODULE)
$(MODULE): $(OBJ_DIR) $(OBJS)
$(CC) -o $(MODULE) $(OBJS) $(CFLAGS) $(LDFLAGS)
clean:
$(RM) $(MODULE)
$(RM) $(DEPEND_FILE)
$(RM) $(OBJ_DIR)
$(OBJS): Makefile
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
$(OBJ_DIR)/%.o: %.c
$(CC) $(CFLAGS) $(COPTS) -c $< -o $@
.PHONY: depend
depend: $(DEPEND_FILE)
$(DEPEND_FILE):
$(CC) -MM $(SRCS) | sed -e 's/^/$(OBJ_DIR)\//g' > $(DEPEND_FILE)
-include $(DEPEND_FILE)