Apply cosmetic cleanup part of ldflags_order patch from Alberto Villa.
[melted] / src / miracle / Makefile
1 include ../../config.mak
2
3 TARGET = miracle
4
5 ifneq ($(targetos), Darwin)
6 LIBNAME = libmiracle$(LIBSUF)
7 LIBTARGET = $(LIBNAME).$(version)
8 LIBSONAME = $(LIBNAME).$(soversion)
9 SHFLAGS += -Wl,-soname,$(LIBSONAME)
10 else
11 LIBNAME = libmiracle$(LIBSUF)
12 LIBTARGET = libmiracle.$(version)$(LIBSUF)
13 LIBSONAME = libmiracle.$(soversion)$(LIBSUF)
14 SHFLAGS += -install_name $(libdir)/$(LIBSONAME) -current_version $(version) -compatibility_version $(soversion)
15 endif
16
17 APP_OBJS = miracle.o
18
19 LIB_OBJS = miracle_log.o \
20 miracle_server.o \
21 miracle_connection.o \
22 miracle_local.o \
23 miracle_unit.o \
24 miracle_commands.o \
25 miracle_unit_commands.o
26
27 INCS = miracle_server.h \
28 miracle_local.h \
29 miracle_log.h
30
31 OBJS = $(APP_OBJS) $(LIB_OBJS)
32
33 CFLAGS += -I.. $(RDYNAMIC)
34
35 LDFLAGS += -L../valerie -lvalerie
36 LDFLAGS += -L../framework -lmlt -lpthread
37
38 SRCS := $(OBJS:.o=.c)
39
40 all: $(TARGET)
41
42 $(TARGET): $(APP_OBJS) $(LIBTARGET)
43 $(CC) -o $@ $(APP_OBJS) -L. -lmiracle $(LDFLAGS)
44
45 $(LIBTARGET): $(LIB_OBJS)
46 $(CC) $(SHFLAGS) -o $@ $(LIB_OBJS) $(LDFLAGS)
47 ln -sf $(LIBTARGET) $(LIBNAME)
48 ln -sf $(LIBTARGET) $(LIBSONAME)
49
50 depend: $(SRCS)
51 $(CC) -MM $(CFLAGS) $^ 1>.depend
52
53 distclean: clean
54 rm -f .depend
55
56 clean:
57 rm -f $(OBJS) $(TARGET) $(LIBNAME) $(LIBTARGET)
58
59 install: all
60 install -d "$(DESTDIR)$(bindir)"
61 install -c -s -m 755 $(TARGET) "$(DESTDIR)$(bindir)"
62 install -m 755 $(LIBTARGET) $(DESTDIR)$(libdir)
63 ln -sf $(LIBTARGET) $(DESTDIR)$(libdir)/$(LIBSONAME)
64 ln -sf $(LIBTARGET) $(DESTDIR)$(libdir)/$(LIBNAME)
65 mkdir -p "$(DESTDIR)$(prefix)/include/mlt/miracle"
66 install -m 644 $(INCS) "$(DESTDIR)$(prefix)/include/mlt/miracle"
67
68 uninstall:
69 rm -f "$(DESTDIR)$(bindir)/$(TARGET)"
70 rm -f "$(DESTDIR)$(libdir)/$(LIBTARGET)"
71 rm -f "$(DESTDIR)$(libdir)/$(LIBSONAME)"
72 rm -f "$(DESTDIR)$(libdir)/$(LIBNAME)"
73 rm -rf "$(DESTDIR)$(prefix)/include/mlt/miracle"
74
75 ifneq ($(wildcard .depend),)
76 include .depend
77 endif