forked from Silicondust/libhdhomerun
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
77 lines (63 loc) · 1.77 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
LIBSRCS += hdhomerun_channels.c
LIBSRCS += hdhomerun_channelscan.c
LIBSRCS += hdhomerun_control.c
LIBSRCS += hdhomerun_debug.c
LIBSRCS += hdhomerun_device.c
LIBSRCS += hdhomerun_device_selector.c
LIBSRCS += hdhomerun_discover.c
LIBSRCS += hdhomerun_pkt.c
LIBSRCS += hdhomerun_video.c
ifeq ($(OS),Windows_NT)
LIBSRCS += hdhomerun_sock_windows.c
LIBSRCS += hdhomerun_os_windows.c
else
LIBSRCS += hdhomerun_sock_posix.c
LIBSRCS += hdhomerun_os_posix.c
endif
CC := $(CROSS_COMPILE)gcc
STRIP := $(CROSS_COMPILE)strip
CFLAGS += -O2 -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wno-unused-parameter -fPIC
LDFLAGS += -lpthread
SHARED = -shared -Wl,-soname,libhdhomerun$(LIBEXT)
ifeq ($(OS),Windows_NT)
BINEXT := .exe
LIBEXT := .dll
LDFLAGS += -liphlpapi
CFLAGS += -DUNICODE -D_UNICODE
else ifeq ($(BUILD_OS),android)
CC = $(CROSS_COMPILE)clang
LIBEXT := .so
LDFLAGS :=
CFLAGS += -DNO_GETIFADDRS
else
OS := $(shell uname -s)
LIBEXT := .so
ifeq ($(OS),Linux)
LDFLAGS += -lrt
endif
ifeq ($(OS),SunOS)
LDFLAGS += -lsocket
endif
ifeq ($(OS),Darwin)
LIBEXT := .dylib
SHARED := -dynamiclib -install_name libhdhomerun$(LIBEXT)
endif
endif
all : hdhomerun_config$(BINEXT) libhdhomerun$(LIBEXT)
hdhomerun_config$(BINEXT) : hdhomerun_config.c $(LIBSRCS)
$(CC) $(CFLAGS) $+ $(LDFLAGS) -o $@
$(STRIP) $@
libhdhomerun$(LIBEXT) : $(LIBSRCS)
$(CC) $(CFLAGS) -fPIC -DDLL_EXPORT $(SHARED) $+ $(LDFLAGS) -o $@
.o : .c
$(CC) $(CFLAGS) -fPIC -c $@
libhdhomerun.a : $(subst .c,.o,$(LIBSRCS))
$(CROSS_COMPILE)ar crs $@ $+
clean :
-rm -f hdhomerun_config$(BINEXT)
-rm -f libhdhomerun$(LIBEXT)
-rm -f libhdhomerun.a *.o
distclean : clean
%:
@echo "(ignoring request to make $@)"
.PHONY: all list clean distclean