4 # Currently, this Makefile is not tested except GNU make.
11 OBJS
= $(SRCS
:%.c
=%.o
)
13 SRC_ALL
= $(SRCS
) $(SRC_TOOLS
)
17 .PHONY
: all lib
install install-lib
clean distclean dep depend
19 all: $(STATICLIB
) $(SHAREDLIB
) $(TOOLS
)
21 lib
: $(STATICLIB
) $(SHAREDLIB
)
23 $(STATICLIBNAME
): $(OBJS
)
26 -@
$(if
$(STRIP
), $(STRIP
) -x
$@
)
28 $(SHAREDLIBNAME
): $(OBJS
)
29 $(LD
) $(SO_LDFLAGS
) $(LDFLAGS
) -o
$@
$^
$(LIBS
)
30 -@
$(if
$(STRIP
), $(STRIP
) -x
$@
)
34 ifeq ($(SHAREDLIBNAME
), liblsmash.so.
$(MAJVER
))
35 ln
-sf
$(SHAREDLIBNAME
) liblsmash.so
38 # $(TOOLS) is automatically generated as config.mak2 by configure.
39 # The reason for having config.mak2 is for making this Makefile easy to read.
42 %.o
: %.c .depend config.h
43 $(CC
) -c
$(CFLAGS
) -o
$@
$<
45 install: all install-lib
46 install -d
$(DESTDIR
)$(bindir)
47 install -m
755 $(TOOLS
) $(DESTDIR
)$(bindir)
49 install-lib
: liblsmash.
pc lib
50 install -d
$(DESTDIR
)$(includedir)
51 install -m
644 $(SRCDIR
)/lsmash.h
$(DESTDIR
)$(includedir)
52 install -d
$(DESTDIR
)$(libdir)/pkgconfig
53 install -m
644 liblsmash.
pc $(DESTDIR
)$(libdir)/pkgconfig
55 install -m
644 $(STATICLIB
) $(DESTDIR
)$(libdir)
59 install -m
644 $(IMPLIB
) $(DESTDIR
)$(libdir)
60 install -d
$(DESTDIR
)$(bindir)
61 install -m
755 $(SHAREDLIB
) $(DESTDIR
)$(bindir)
63 install -m
644 $(DEFNAME
) $(DESTDIR
)$(libdir)
64 install -m
644 lsmash.lib
$(DESTDIR
)$(bindir)
67 install -m
644 $(SHAREDLIB
) $(DESTDIR
)$(libdir)
68 ifeq ($(SHAREDLIB
), liblsmash.so.
$(MAJVER
))
69 ln
-sf
$(SHAREDLIB
) $(DESTDIR
)$(libdir)/liblsmash.so
74 #All objects should be deleted regardless of configure when uninstall/clean/distclean.
76 $(RM
) $(DESTDIR
)$(includedir)/lsmash.h
77 $(RM
) $(addprefix $(DESTDIR
)$(libdir)/, liblsmash.a liblsmash.dll.a liblsmash.so
* liblsmash.dylib liblsmash
*.def pkgconfig
/liblsmash.
pc)
78 $(RM
) $(addprefix $(DESTDIR
)$(bindir)/, $(TOOLS_ALL
) $(TOOLS_ALL
:%=%.exe
) liblsmash
*.dll lsmash.lib cyglsmash.dll
)
81 $(RM
) */*.o
*.a
*.so
* *.def
*.exp
*.lib
*.dll
*.dylib
$(addprefix cli
/, *.exe
$(TOOLS_ALL
)) .depend
84 $(RM
) config.
* *.
pc *.ver
90 ifneq ($(wildcard .depend
),)
94 #The dependency of each source file is solved automatically by follows.
97 @
$(foreach SRC
, $(SRC_ALL
:%=$(SRCDIR
)/%), $(CC
) $(SRC
) $(CFLAGS
) -g0
-MT
$(SRC
:$(SRCDIR
)/%.c
=%.o
) -MM
>> .depend
;)