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
$@
)
31 ifeq ($(SHAREDLIBNAME
), liblsmash.so.
$(MAJVER
))
32 ln
-sf
$(SHAREDLIBNAME
) liblsmash.so
35 # $(TOOLS) is automatically generated as config.mak2 by configure.
36 # The reason for having config.mak2 is for making this Makefile easy to read.
39 %.o
: %.c .depend config.h
40 $(CC
) -c
$(CFLAGS
) -o
$@
$<
42 install: all install-lib
43 install -d
$(DESTDIR
)$(bindir)
44 install -m
755 $(TOOLS
) $(DESTDIR
)$(bindir)
46 install-lib
: liblsmash.
pc lib
47 install -d
$(DESTDIR
)$(includedir)
48 install -m
644 $(SRCDIR
)/lsmash.h
$(DESTDIR
)$(includedir)
49 install -d
$(DESTDIR
)$(libdir)/pkgconfig
50 install -m
644 liblsmash.
pc $(DESTDIR
)$(libdir)/pkgconfig
52 install -m
644 $(STATICLIB
) $(DESTDIR
)$(libdir)
56 install -m
644 $(IMPLIB
) $(DESTDIR
)$(libdir)
57 install -d
$(DESTDIR
)$(bindir)
58 install -m
755 $(SHAREDLIB
) $(DESTDIR
)$(bindir)
60 install -m
644 $(SHAREDLIB
) $(DESTDIR
)$(libdir)
61 ifeq ($(SHAREDLIB
), liblsmash.so.
$(MAJVER
))
62 ln
-sf
$(SHAREDLIB
) $(DESTDIR
)$(libdir)/liblsmash.so
67 #All objects should be deleted regardless of configure when uninstall/clean/distclean.
69 $(RM
) $(DESTDIR
)$(includedir)/lsmash.h
70 $(RM
) $(addprefix $(DESTDIR
)$(libdir)/, liblsmash.a liblsmash.dll.a liblsmash.so
* liblsmash.dylib pkgconfig
/liblsmash.
pc)
71 $(RM
) $(addprefix $(DESTDIR
)$(bindir)/, $(TOOLS_ALL
) $(TOOLS_ALL
:%=%.exe
) liblsmash.dll cyglsmash.dll
)
74 $(RM
) */*.o
*.a
*.so
* *.dll
*.dylib
$(addprefix cli
/, *.exe
$(TOOLS_ALL
)) .depend
83 ifneq ($(wildcard .depend
),)
87 #The dependency of each source file is solved automatically by follows.
90 @
$(foreach SRC
, $(SRC_ALL
:%=$(SRCDIR
)/%), $(CC
) $(SRC
) $(CFLAGS
) -g0
-MT
$(SRC
:$(SRCDIR
)/%.c
=%.o
) -MM
>> .depend
;)