forked from l-smash/l-smash
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
109 lines (83 loc) · 2.68 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Makefile for L-SMASH
# note:
# Currently, this Makefile is not tested except GNU make.
include config.mak
vpath %.c $(SRCDIR)
vpath %.h $(SRCDIR)
OBJS = $(SRCS:%.c=%.o)
SRC_ALL = $(SRCS) $(SRC_TOOLS)
#### main rules ####
.PHONY: all lib install install-lib clean distclean dep depend
all: $(STATICLIB) $(SHAREDLIB) $(TOOLS)
lib: $(STATICLIB) $(SHAREDLIB)
$(STATICLIBNAME): $(OBJS)
$(AR) rc $@ $^
$(RANLIB) $@
-@ $(if $(STRIP), $(STRIP) -x $@)
$(SHAREDLIBNAME): $(OBJS)
$(LD) $(SO_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
-@ $(if $(STRIP), $(STRIP) -x $@)
ifneq ($(SLIB_CMD),)
$(SLIB_CMD)
endif
ifeq ($(SHAREDLIBNAME), liblsmash.so.$(MAJVER))
ln -sf $(SHAREDLIBNAME) liblsmash.so
endif
# $(TOOLS) is automatically generated as config.mak2 by configure.
# The reason for having config.mak2 is for making this Makefile easy to read.
include config.mak2
%.o: %.c .depend config.h
$(CC) -c $(CFLAGS) -o $@ $<
install: all install-lib
install -d $(DESTDIR)$(bindir)
install -m 755 $(TOOLS) $(DESTDIR)$(bindir)
install-lib: liblsmash.pc lib
install -d $(DESTDIR)$(includedir)
install -m 644 $(SRCDIR)/lsmash.h $(DESTDIR)$(includedir)
install -d $(DESTDIR)$(libdir)/pkgconfig
install -m 644 liblsmash.pc $(DESTDIR)$(libdir)/pkgconfig
ifneq ($(STATICLIB),)
install -m 644 $(STATICLIB) $(DESTDIR)$(libdir)
endif
ifneq ($(SHAREDLIB),)
ifneq ($(IMPLIB),)
install -m 644 $(IMPLIB) $(DESTDIR)$(libdir)
install -d $(DESTDIR)$(bindir)
install -m 755 $(SHAREDLIB) $(DESTDIR)$(bindir)
ifneq ($(SLIB_CMD),)
install -m 644 $(DEFNAME) $(DESTDIR)$(libdir)
install -m 644 lsmash.lib $(DESTDIR)$(bindir)
endif
else
install -m 644 $(SHAREDLIB) $(DESTDIR)$(libdir)
ifeq ($(SHAREDLIB), liblsmash.so.$(MAJVER))
ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/liblsmash.so
endif
endif
endif
#All objects should be deleted regardless of configure when uninstall/clean/distclean.
uninstall:
$(RM) $(DESTDIR)$(includedir)/lsmash.h
$(RM) $(addprefix $(DESTDIR)$(libdir)/, liblsmash.a liblsmash.dll.a liblsmash.so* liblsmash.dylib liblsmash*.def pkgconfig/liblsmash.pc)
$(RM) $(addprefix $(DESTDIR)$(bindir)/, $(TOOLS_ALL) $(TOOLS_ALL:%=%.exe) liblsmash*.dll lsmash.lib cyglsmash.dll)
clean:
$(RM) */*.o *.a *.so* *.def *.exp *.lib *.dll *.dylib $(addprefix cli/, *.exe $(TOOLS_ALL)) .depend
distclean: clean
$(RM) config.* *.pc *.ver
dep: .depend
depend: .depend
ifneq ($(wildcard .depend),)
include .depend
endif
#The dependency of each source file is solved automatically by follows.
.depend: config.mak
@$(RM) .depend
@$(foreach SRC, $(SRC_ALL:%=$(SRCDIR)/%), $(CC) $(SRC) $(CFLAGS) -g0 -MT $(SRC:$(SRCDIR)/%.c=%.o) -MM >> .depend;)
liblsmash.pc:
./configure
config.h:
./configure
config.mak2:
./configure
config.mak:
./configure