forked from selsta/hlsdl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
61 lines (50 loc) · 1.65 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
# Makefile inspiration from Kore (Kore.io)
CC?=gcc
PREFIX?=/usr/local
HLSDL=hlsdl
INSTALL_DIR=$(PREFIX)/bin
MAN=hlsdl.1
INSTALL_DIR_MAN=$(PREFIX)/man/man1
OSNAME=$(shell uname -s | sed -e 's/[-_].*//g' | tr A-Z a-z)
S_SRC= src/main.c src/aes_openssl.c src/curl.c src/hls.c src/misc.c src/msg.c src/mpegts.c
ifeq ("$(OSNAME)", "darwin")
OPENSSL_MACOS=$(shell brew --prefix openssl)
CFLAGS+=-I/usr/local/include/
CFLAGS+=-I$(OPENSSL_MACOS)/include
LDFLAGS+=-L/usr/local/lib
LDFLAGS+=-L$(OPENSSL_MACOS)/lib
else ifeq ("$(OSNAME)", "linux")
CFLAGS+=-D_GNU_SOURCE=1 -std=gnu99
else ifneq ($(findstring "$(OSNAME)","mingw32" "mingw64" "cygwin"),)
CFLAGS+=-D_GNU_SOURCE=1 -std=gnu99 -DCURL_STATICLIB
S_SRC+=msvc/win/memmem.c
else
endif
S_OBJS= $(S_SRC:.c=.o)
CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
CFLAGS+=-Wsign-compare -Iincludes
CFLAGS+=-DPREFIX='"$(PREFIX)"'
ifeq ("$(OSNAME)", "cygwin")
LDFLAGS+=-lpthread $(shell pkg-config libcurl --static --libs)
else ifneq ($(findstring "$(OSNAME)","mingw32" "mingw64"),)
LDFLAGS+=-Wl,-Bstatic -lpthread -lcurl -lnghttp2 -lssh2 -lbrotlidec-static -lbrotlicommon-static -lssl -lcrypto -lcrypt32 -lwsock32 -lws2_32 -lwldap32 -lz
else
LDFLAGS+=-lpthread -lcurl -lcrypto -lssl
endif
all: $(HLSDL)
hlsdl: $(S_OBJS)
$(CC) $(S_OBJS) $(LDFLAGS) -o $(HLSDL)
install:
mkdir -p $(INSTALL_DIR)
install -m 755 $(HLSDL) $(INSTALL_DIR)/$(HLSDL)
mkdir -p $(INSTALL_DIR_MAN)
cp $(MAN) $(INSTALL_DIR_MAN)
uninstall:
rm -f $(INSTALL_DIR)/$(HLSDL)
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
clean:
find . -type f -name \*.o -exec rm {} \;
rm -f $(HLSDL)
.PHONY: clean