-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
54 lines (43 loc) · 1.17 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
MAIN := main.c
SOURCE := $(filter-out $(MAIN),$(wildcard *.c))
OBJECT := $(subst .c,.o,$(SOURCE))
DEP := $(subst .c,.d,$(SOURCE))
BINARY := shell-fm
LIB := libshellfm.so
STATIC := libshellfm.a
CFLAGS += -Os -Wall -MD -W -I./include/
ifdef EXTERN_ONLY
CFLAGS += -DEXTERN_ONLY
else
ifeq ($(shell uname -s), OpenBSD)
LDFLAGS += -lossaudio
endif
ifeq ($(shell uname -s), NetBSD)
LDFLAGS += -lossaudio
endif
ifeq ($(shell uname -s), Darwin)
CFLAGS += -D__darwin__
endif
CFLAGS += -DLIBAO \
$(shell pkg-config --cflags mad) \
$(shell pkg-config --cflags ao)
LDFLAGS += $(shell pkg-config --libs mad) \
$(shell pkg-config --libs ao)
ifeq ($(shell pkg-config --exists taglib_c && echo 1), 1)
CFLAGS += $(shell pkg-config --cflags taglib_c) -DTAGLIB
LDFLAGS += $(shell pkg-config --libs taglib_c)
endif
endif
.PHONY: clean tags cscope
all : $(BINARY)
$(LIB) : $(OBJECT)
$(CC) -shared -Wl,-soname,$(LIB) -o $(LIB) $(OBJECT)
$(STATIC) : $(OBJECT)
$(AR) -cvq $(STATIC) $(OBJECT)
$(BINARY) : $(STATIC) $(MAIN)
$(CC) -o $(BINARY) $(CFLAGS) $(MAIN) $(LDFLAGS) $(STATIC)
clean :
rm -f $(OBJECT) $(BINARY) $(LIB) $(STATIC) $(DEP)
tags cscope :
$(MAKE) -C .. $@
sinclude $(DEP)