-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
50 lines (35 loc) · 1003 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
# Makefile for deramp
# for shared library only
# for compiling the executable, replace line 29 with
# all: ${TARGET_LIB} ${TARGET}
CC = gcc # C compiler
CFLAGS = -fPIC -Wall -Wextra -O2 -g # C flags
LDFLAGS = -shared # linking flags
RM = rm -f # rm command
# for deramping with mean:
#TARGET_LIB = deramp.so # target lib
#SRCS = deramp.c # source files
#OBJS = $(SRCS:.c=.o)
#TARGET = deramp
# for deramping with median:
#TARGET_LIB = deramp_median.so # target lib
#SRCS = deramp_median.c # source files
#OBJS = $(SRCS:.c=.o)
#TARGET = deramp_median
# for deramping with mode:
TARGET_LIB = deramp_mode.so # target lib
SRCS = deramp_mode.c # source files
OBJS = $(SRCS:.c=.o)
TARGET = deramp_mode
.PHONY: all
all: ${TARGET_LIB}
$(TARGET_LIB): $(OBJS)
$(CC) ${LDFLAGS} -o $@ $^
$(SRCS:.c=.d):%.d:%.c
$(CC) $(CFLAGS) -MM $< >$@
$(TARGET): $(TARGET).c
$(CC) $(CFLAGS) -o $(TARGET) $(SRCS)
include $(SRCS:.c=.d)
.PHONY: clean
clean:
-${RM} ${TARGET_LIB} ${TARGET} ${OBJS} $(SRCS:.c=.d)