Merge branch 'nto-signal-stats'
[dvblast.git] / Makefile
blobe6eec222ebcdd89e39ccf2156ff2d8f6160e333a
1 VERSION_MAJOR = 3
2 VERSION_MINOR = 4
3 TOPDIR = `basename ${PWD}`
4 GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
5 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
6 deltacast_inc := $(shell sh -c 'test -f /usr/include/StreamMaster.h && echo -n Y')
8 CFLAGS ?= -O3 -fomit-frame-pointer -g
9 CFLAGS += -Wall -Wformat-security -Wno-strict-aliasing
10 CFLAGS += -DVERSION=\"$(VERSION_MAJOR).$(VERSION_MINOR)\"
11 CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR)
12 CFLAGS += -DVERSION_MINOR=$(VERSION_MINOR)
13 ifneq "$(GIT_VER)" ""
14 CFLAGS += -DVERSION_EXTRA=\"git-$(GIT_VER)\"
15 else
16 CFLAGS += -DVERSION_EXTRA=\"release\"
17 endif
19 ifeq ($(uname_S),Linux)
20 LDLIBS += -lrt
21 endif
22 ifeq ($(uname_S),Darwin)
23 LDLIBS += -liconv
24 endif
26 ifeq ($(deltacast_inc),Y)
27 CFLAGS += -DHAVE_ASI_DELTACAST_SUPPORT
28 LDLIBS += -lstreammaster
29 endif
31 LDLIBS_DVBLAST += -lpthread -lev
33 OBJ_DVBLAST = dvblast.o util.o dvb.o udp.o asi.o demux.o output.o en50221.o comm.o mrtg-cnt.o asi-deltacast.o
34 OBJ_DVBLASTCTL = util.o dvblastctl.o
36 ifndef V
37 Q = @
38 endif
40 CLEAN_OBJS = dvblast dvblastctl $(OBJ_DVBLAST) $(OBJ_DVBLASTCTL)
41 INSTALL_BIN = dvblast dvblastctl dvblast_mmi.sh
42 INSTALL_MAN = dvblast.1
44 PREFIX ?= /usr/local
45 BIN = $(subst //,/,$(DESTDIR)/$(PREFIX)/bin)
46 MAN = $(subst //,/,$(DESTDIR)/$(PREFIX)/share/man/man1)
48 all: dvblast dvblastctl
50 .PHONY: clean install uninstall dist
52 %.o: %.c Makefile config.h dvblast.h en50221.h comm.h asi.h mrtg-cnt.h asi-deltacast.h
53 @echo "CC $<"
54 $(Q)$(CROSS)$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
56 dvblast: $(OBJ_DVBLAST)
57 @echo "LINK $@"
58 $(Q)$(CROSS)$(CC) $(LDFLAGS) -o $@ $(OBJ_DVBLAST) $(LDLIBS_DVBLAST) $(LDLIBS)
60 dvblastctl: $(OBJ_DVBLASTCTL)
61 @echo "LINK $@"
62 $(Q)$(CROSS)$(CC) $(LDFLAGS) -o $@ $(OBJ_DVBLASTCTL) $(LDLIBS)
64 clean:
65 @echo "CLEAN $(CLEAN_OBJS)"
66 $(Q)rm -f $(CLEAN_OBJS)
68 distclean: clean
70 install: all
71 @install -d "$(BIN)"
72 @install -d "$(MAN)"
73 @echo "INSTALL $(INSTALL_MAN) -> $(MAN)"
74 $(Q)install -m 644 dvblast.1 "$(MAN)"
75 @echo "INSTALL $(INSTALL_BIN) -> $(BIN)"
76 $(Q)install dvblast dvblastctl dvblast_mmi.sh "$(BIN)"
78 uninstall:
79 @-for FILE in $(INSTALL_BIN); do \
80 echo "RM $(BIN)/$$FILE"; \
81 rm "$(BIN)/$$FILE"; \
82 done
83 @-for FILE in $(INSTALL_MAN); do \
84 echo "RM $(MAN)/$$FILE"; \
85 rm "$(MAN)/$$FILE"; \
86 done
88 dist: clean
89 @echo "ARCHIVE dvblast-$(VERSION_MAJOR).$(VERSION_MINOR).tar.bz2"
90 $(Q)git archive --format=tar --prefix=dvblast-$(VERSION_MAJOR).$(VERSION_MINOR)/ master | bzip2 -9 > dvblast-$(VERSION_MAJOR).$(VERSION_MINOR).tar.bz2
91 $(Q)ls -l dvblast-$(VERSION_MAJOR).$(VERSION_MINOR).tar.bz2