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
$@
)
32 # $(TOOLS) is automatically generated as config.mak2 by configure.
33 # The reason for having config.mak2 is for making this Makefile easy to read.
36 %.o
: %.c .depend config.h
37 $(CC
) -c
$(CFLAGS
) -o
$@
$<
39 install: all install-lib
40 install -d
$(DESTDIR
)$(bindir)
41 install -m
755 $(TOOLS
) $(DESTDIR
)$(bindir)
43 install-lib
: liblsmash.
pc lib
44 install -d
$(DESTDIR
)$(includedir)
45 install -m
644 $(SRCDIR
)/lsmash.h
$(DESTDIR
)$(includedir)
46 install -d
$(DESTDIR
)$(libdir)/pkgconfig
47 install -m
644 liblsmash.
pc $(DESTDIR
)$(libdir)/pkgconfig
49 install -m
644 $(STATICLIB
) $(DESTDIR
)$(libdir)
53 install -m
644 $(IMPLIB
) $(DESTDIR
)$(libdir)
54 install -d
$(DESTDIR
)$(bindir)
55 install -m
755 $(SHAREDLIB
) $(DESTDIR
)$(bindir)
57 install -m
644 $(SHAREDLIB
) $(DESTDIR
)$(libdir)
61 #All objects should be deleted regardless of configure when uninstall/clean/distclean.
63 $(RM
) $(DESTDIR
)$(includedir)/lsmash.h
64 $(RM
) $(addprefix $(DESTDIR
)$(libdir)/, liblsmash.a liblsmash.dll.a liblsmash.so liblsmash.dylib pkgconfig
/liblsmash.
pc)
65 $(RM
) $(addprefix $(DESTDIR
)$(bindir)/, $(TOOLS_ALL
) $(TOOLS_ALL
:%=%.exe
) liblsmash.dll cyglsmash.dll
)
68 $(RM
) */*.o
*.a
*.so
*.dll
*.dylib
$(addprefix cli
/, *.exe
$(TOOLS_ALL
)) .depend
77 ifneq ($(wildcard .depend
),)
81 #The dependency of each source file is solved automatically by follows.
84 @
$(foreach SRC
, $(SRC_ALL
:%=$(SRCDIR
)/%), $(CC
) $(SRC
) $(CFLAGS
) -g0
-MT
$(SRC
:$(SRCDIR
)/%.c
=%.o
) -MM
>> .depend
;)