alac: Utilize meaningful error values.
[L-SMASH.git] / Makefile
blob83ecb0ffa0e310b6eaacee050d22c7911cb68e9c
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 $@)
31 ifeq ($(SHAREDLIBNAME), liblsmash.so.$(MAJVER))
32 ln -s $(SHAREDLIBNAME) liblsmash.so
33 endif
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.
37 include config.mak2
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
51 ifneq ($(STATICLIB),)
52 install -m 644 $(STATICLIB) $(DESTDIR)$(libdir)
53 endif
54 ifneq ($(SHAREDLIB),)
55 ifneq ($(IMPLIB),)
56 install -m 644 $(IMPLIB) $(DESTDIR)$(libdir)
57 install -d $(DESTDIR)$(bindir)
58 install -m 755 $(SHAREDLIB) $(DESTDIR)$(bindir)
59 else
60 install -m 644 $(SHAREDLIB) $(DESTDIR)$(libdir)
61 ifeq ($(SHAREDLIB), liblsmash.so.$(MAJVER))
62 ln -s $(SHAREDLIB) $(DESTDIR)$(libdir)/liblsmash.so
63 endif
64 endif
65 endif
67 #All objects should be deleted regardless of configure when uninstall/clean/distclean.
68 uninstall:
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)
73 clean:
74 $(RM) */*.o *.a *.so* *.dll *.dylib $(addprefix cli/, *.exe $(TOOLS_ALL)) .depend
76 distclean: clean
77 $(RM) config.* *.pc
79 dep: .depend
81 depend: .depend
83 ifneq ($(wildcard .depend),)
84 include .depend
85 endif
87 #The dependency of each source file is solved automatically by follows.
88 .depend: config.mak
89 @$(RM) .depend
90 @$(foreach SRC, $(SRC_ALL:%=$(SRCDIR)/%), $(CC) $(SRC) $(CFLAGS) -g0 -MT $(SRC:$(SRCDIR)/%.c=%.o) -MM >> .depend;)
92 liblsmash.pc:
93 ./configure
95 config.h:
96 ./configure
98 config.mak2:
99 ./configure
101 config.mak:
102 ./configure