forked from hmflash/tikitank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (45 loc) · 1.48 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
CC = gcc
CFLAGS=-Wall -O2
PRUFLAGS=-Wno-unused-result -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast
LD = gcc
LDFLAGS=
TARGET=tikitank
EFFECT=effects
PRUDRV=prussdrv
SRCDIR=src
OBJDIR=obj
BINDIR=bin
LIBS=-lpthread -lrt
COMMON_SRC := $(wildcard $(SRCDIR)/*.c)
COMMON_INC := $(wildcard $(SRCDIR)/*.h)
COMMON_OBJ := $(COMMON_SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
PRUDRV_SRC := $(wildcard $(SRCDIR)/$(PRUDRV)/*.c)
PRUDRV_INC := $(wildcard $(SRCDIR)/$(PRUDRV)/*.h)
PRUDRV_OBJ := $(PRUDRV_SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
EFFECT_SRC := $(wildcard $(SRCDIR)/$(EFFECT)/*.c)
EFFECT_INC := $(wildcard $(SRCDIR)/$(EFFECT)/*.h)
EFFECT_OBJ := $(EFFECT_SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
.PHONY: all clean
all: $(BINDIR)/$(TARGET)
$(BINDIR)/$(TARGET): $(COMMON_OBJ) $(PRUDRV_OBJ) $(EFFECT_OBJ)
$(LD) $(LDFLAGS) -o $@ $(COMMON_OBJ) $(PRUDRV_OBJ) $(EFFECT_OBJ) $(LIBS)
$(COMMON_OBJ): | $(OBJDIR)
$(PRUDRV_OBJ): | $(OBJDIR)/$(PRUDRV)
$(EFFECT_OBJ): | $(OBJDIR)/$(EFFECT)
$(OBJDIR):
@mkdir -p $@
$(OBJDIR)/$(PRUDRV):
@mkdir -p $@
$(OBJDIR)/$(EFFECT):
@mkdir -p $@
$(BINDIR)/$(TARGET) : | $(BINDIR)
$(BINDIR):
@mkdir -p $@
$(COMMON_OBJ): $(OBJDIR)/%.o : $(SRCDIR)/%.c $(COMMON_INC) $(PRUDRV_INC)
$(CC) $(CFLAGS) -I$(SRCDIR)/prussdrv -c -o $@ $<
$(PRUDRV_OBJ): $(OBJDIR)/%.o : $(SRCDIR)/%.c $(PRUDRV_INC)
$(CC) $(CFLAGS) $(PRUFLAGS) -I$(SRCDIR)/prussdrv -c -o $@ $<
$(EFFECT_OBJ): $(OBJDIR)/%.o : $(SRCDIR)/%.c $(COMMON_INC) $(EFFECT_INC)
$(CC) $(CFLAGS) -I$(SRCDIR) -c -o $@ $<
clean:
rm -rf $(OBJDIR) $(BINDIR)