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