~ubuntu-branches/debian/jessie/tsdecrypt/jessie

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2012-04-04 09:42:43 UTC
  • Revision ID: package-import@ubuntu.com-20120404094243-qsc40h18oolnxw5r
Tags: upstream-7.0
ImportĀ upstreamĀ versionĀ 7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
CC = $(CROSS)$(TARGET)cc
 
2
STRIP = $(CROSS)$(TARGET)strip
 
3
MKDEP = $(CC) -M -o $*.d $<
 
4
RM = /bin/rm -f
 
5
 
 
6
BUILD_ID = $(shell date +%F_%R)
 
7
VERSION = $(shell cat RELEASE)
 
8
GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
 
9
ifeq "$(GIT_VER)" ""
 
10
GIT_VER = "release"
 
11
endif
 
12
 
 
13
ifndef V
 
14
Q = @
 
15
endif
 
16
 
 
17
CFLAGS ?= -O2 -ggdb \
 
18
 -W -Wall -Wextra \
 
19
 -Wshadow -Wformat-security -Wstrict-prototypes
 
20
 
 
21
DEFS = -DBUILD_ID=\"$(BUILD_ID)\" \
 
22
 -DVERSION=\"$(VERSION)\" -DGIT_VER=\"$(GIT_VER)\"
 
23
 
 
24
PREFIX ?= /usr/local
 
25
 
 
26
INSTALL_PRG = tsdecrypt
 
27
INSTALL_PRG_DIR = $(subst //,/,$(DESTDIR)/$(PREFIX)/bin)
 
28
 
 
29
INSTALL_DOC = tsdecrypt.1
 
30
INSTALL_DOC_DIR = $(subst //,/,$(DESTDIR)/$(PREFIX)/man/man1)
 
31
 
 
32
FUNCS_DIR = libfuncs
 
33
FUNCS_LIB = $(FUNCS_DIR)/libfuncs.a
 
34
 
 
35
TS_DIR = libtsfuncs
 
36
TS_LIB = $(TS_DIR)/libtsfuncs.a
 
37
 
 
38
tsdecrypt_SRC = data.c \
 
39
 udp.c \
 
40
 util.c \
 
41
 camd.c \
 
42
 camd-cs378x.c \
 
43
 camd-newcamd.c \
 
44
 process.c \
 
45
 tables.c \
 
46
 notify.c \
 
47
 tsdecrypt.c
 
48
tsdecrypt_LIBS = -lcrypto -ldvbcsa -lpthread
 
49
tsdecrypt_OBJS = $(FUNCS_LIB) $(TS_LIB) $(tsdecrypt_SRC:.c=.o)
 
50
 
 
51
ifeq "$(shell uname -s)" "Linux"
 
52
tsdecrypt_LIBS += -lcrypt -lrt
 
53
endif
 
54
 
 
55
CLEAN_OBJS = tsdecrypt $(tsdecrypt_SRC:.c=.{o,d})
 
56
 
 
57
PROGS = tsdecrypt
 
58
 
 
59
.PHONY: distclean clean install uninstall
 
60
 
 
61
all: $(PROGS)
 
62
 
 
63
$(FUNCS_LIB): $(FUNCS_DIR)/libfuncs.h
 
64
        $(Q)echo "  MAKE        $(FUNCS_LIB)"
 
65
        $(Q)$(MAKE) -s -C $(FUNCS_DIR)
 
66
 
 
67
$(TS_LIB): $(TS_DIR)/tsfuncs.h $(TS_DIR)/tsdata.h
 
68
        $(Q)echo "  MAKE        $(TS_LIB)"
 
69
        $(Q)$(MAKE) -s -C $(TS_DIR)
 
70
 
 
71
tsdecrypt: $(tsdecrypt_OBJS)
 
72
        $(Q)echo "  LINK        tsdecrypt"
 
73
        $(Q)$(CC) $(CFLAGS) $(DEFS) $(tsdecrypt_OBJS) $(tsdecrypt_LIBS) -o tsdecrypt
 
74
 
 
75
%.o: %.c RELEASE
 
76
        @$(MKDEP)
 
77
        $(Q)echo "  CC  tsdecrypt       $<"
 
78
        $(Q)$(CC) $(CFLAGS) $(DEFS) -c $<
 
79
 
 
80
-include $(tsdecrypt_SRC:.c=.d)
 
81
 
 
82
strip:
 
83
        $(Q)echo "  STRIP       $(PROGS)"
 
84
        $(Q)$(STRIP) $(PROGS)
 
85
 
 
86
clean:
 
87
        $(Q)echo "  RM  $(CLEAN_OBJS)"
 
88
        $(Q)$(RM) $(CLEAN_OBJS)
 
89
 
 
90
distclean: clean
 
91
        $(Q)$(MAKE) -s -C $(TS_DIR) clean
 
92
        $(Q)$(MAKE) -s -C $(FUNCS_DIR) clean
 
93
 
 
94
install: all strip
 
95
        @install -d "$(INSTALL_PRG_DIR)"
 
96
        @install -d "$(INSTALL_DOC_DIR)"
 
97
        @echo "INSTALL $(INSTALL_PRG) -> $(INSTALL_PRG_DIR)"
 
98
        $(Q)-install $(INSTALL_PRG) "$(INSTALL_PRG_DIR)"
 
99
        @echo "INSTALL $(INSTALL_DOC) -> $(INSTALL_DOC_DIR)"
 
100
        $(Q)-install --mode 0644 $(INSTALL_DOC) "$(INSTALL_DOC_DIR)"
 
101
 
 
102
uninstall:
 
103
        @-for FILE in $(INSTALL_PRG); do \
 
104
                echo "RM       $(INSTALL_PRG_DIR)/$$FILE"; \
 
105
                rm "$(INSTALL_PRG_DIR)/$$FILE"; \
 
106
        done
 
107
        @-for FILE in $(INSTALL_DOC); do \
 
108
                echo "RM       $(INSTALL_DOC_DIR)/$$FILE"; \
 
109
                rm "$(INSTALL_DOC_DIR)/$$FILE"; \
 
110
        done