-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (57 loc) · 1.58 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
TOPDIR := $(PWD)
DESTDIR :=
PREFIX := /usr/local
LIBDIR := $(PREFIX)/lib
CROSS_COMPILE :=
# comment out this line or pass "USE_SSL=" with any value other than "1" to
# "make" to disable SSL. It may be needed to force SSL_CFLAGS to include
# certain paths, and SSL_LFLAGS to load libs from certain paths.
USE_SSL := 1
CC := $(CROSS_COMPILE)cc
OPT_CFLAGS := -O3
CPU_CFLAGS := -fomit-frame-pointer
DEB_CFLAGS := -Wall -g
DEF_CFLAGS :=
USR_CFLAGS :=
INC_CFLAGS :=
SSL_CFLAGS :=
THR_CFLAGS := -pthread
ifeq ($(USE_SSL),1)
USE_CFLAGS := -DUSE_SSL=1
else
USE_CFLAGS :=
endif
CFLAGS := $(OPT_CFLAGS) $(CPU_CFLAGS) $(DEB_CFLAGS) $(DEF_CFLAGS) $(USR_CFLAGS) $(INC_CFLAGS) $(SSL_CFLAGS) $(THR_CFLAGS) $(USE_CFLAGS)
LD := $(CC)
DEB_LFLAGS := -g
USR_LFLAGS :=
LIB_LFLAGS :=
ifeq ($(USE_SSL),1)
SSL_LFLAGS := -lssl -lcrypto
else
SSL_LFLAGS :=
endif
THR_LFLAGS := -pthread
LDFLAGS := $(DEB_LFLAGS) $(USR_LFLAGS) $(LIB_LFLAGS) $(SSL_LFLAGS) $(THR_LFLAGS)
AR := $(CROSS_COMPILE)ar
STRIP := $(CROSS_COMPILE)strip
INSTALL := install
BINS := h1load
OBJS :=
OBJS += $(patsubst %.c,%.o,$(wildcard src/*.c))
OBJS += $(patsubst %.S,%.o,$(wildcard src/*.S))
all: static shared tools
static: $(STATIC)
shared: $(SHARED)
tools: $(BINS)
h1load: h1load.o
$(LD) -o $@ $^ $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
install: install-tools
install-tools: tools
$(STRIP) $(BINS)
[ -d "$(DESTDIR)$(PREFIX)/bin/." ] || mkdir -p -m 0755 $(DESTDIR)$(PREFIX)/bin
$(INSTALL) -m 0755 -t $(DESTDIR)$(PREFIX)/bin $(BINS)
clean:
-rm -f $(BINS) $(OBJS) *.o *~