nalu: Move common macros for H.264 and HEVC into nalu.h.
[L-SMASH.git] / Makefile
blob8409ed27943bc01d6f59b804ca96e530e21a09a2
1 # Makefile for L-SMASH
3 # note:
4 # Currently, this Makefile is not tested except GNU make.
6 include config.mak
8 vpath %.c $(SRCDIR)
9 vpath %.h $(SRCDIR)
11 OBJS = $(SRCS:%.c=%.o)
13 SRC_ALL = $(SRCS) $(SRC_TOOLS)
15 #### main rules ####
17 .PHONY: all lib install install-lib clean distclean dep depend
19 all: $(STATICLIB) $(SHAREDLIB) $(TOOLS)
21 lib: $(STATICLIB) $(SHAREDLIB)
23 $(STATICLIBNAME): $(OBJS)
24 $(AR) rc $@ $^
25 $(RANLIB) $@
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.
34 include config.mak2
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
48 ifneq ($(STATICLIB),)
49 install -m 644 $(STATICLIB) $(DESTDIR)$(libdir)
50 endif
51 ifneq ($(SHAREDLIB),)
52 ifneq ($(IMPLIB),)
53 install -m 644 $(IMPLIB) $(DESTDIR)$(libdir)
54 install -d $(DESTDIR)$(bindir)
55 install -m 755 $(SHAREDLIB) $(DESTDIR)$(bindir)
56 else
57 install -m 644 $(SHAREDLIB) $(DESTDIR)$(libdir)
58 endif
59 endif
61 #All objects should be deleted regardless of configure when uninstall/clean/distclean.
62 uninstall:
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)
67 clean:
68 $(RM) */*.o *.a *.so *.dll *.dylib $(addprefix cli/, *.exe $(TOOLS_ALL)) .depend
70 distclean: clean
71 $(RM) config.* *.pc
73 dep: .depend
75 depend: .depend
77 ifneq ($(wildcard .depend),)
78 include .depend
79 endif
81 #The dependency of each source file is solved automatically by follows.
82 .depend: config.mak
83 @$(RM) .depend
84 @$(foreach SRC, $(SRC_ALL:%=$(SRCDIR)/%), $(CC) $(SRC) $(CFLAGS) -g0 -MT $(SRC:$(SRCDIR)/%.c=%.o) -MM >> .depend;)
86 liblsmash.pc:
87 ./configure
89 config.h:
90 ./configure
92 config.mak2:
93 ./configure
95 config.mak:
96 ./configure