-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
72 lines (53 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
72
#
# Makefile for proxychains (requires GNU make), stolen from musl
#
# Use config.mak to override any of the following variables.
# Do not make changes here.
#
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
includedir = $(prefix)/include
libdir = $(prefix)/lib
SRCS = $(sort $(wildcard *.c))
OBJS = $(SRCS:.c=.o)
LOBJS = $(OBJS:.o=.lo)
SONAME = librocksock.so
ANAME = librocksock.a
#EX_SRCS = $(sort $(wildcard examples/*.c))
EX_SRCS = examples/http_test.c examples/rocksock_test3.c \
examples/ssh-socks-restart.c examples/proxychk.c
EX_PROGS = $(EX_SRCS:.c=.out)
CFLAGS += -Wall -std=c99 -D_GNU_SOURCE -pipe
INC =
PIC = -fPIC -shared
AR = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib
ALL_LIBS = $(ANAME)
ALL_INCLUDES = rocksock.h
-include config.mak
examples: $(ALL_LIBS) $(EX_PROGS)
all: $(ALL_LIBS)
install: $(ALL_LIBS:lib%=$(DESTDIR)$(libdir)/lib%) $(ALL_INCLUDES:%=$(DESTDIR)$(includedir)/%)
$(DESTDIR)$(libdir)/%: $(ALL_LIBS)
install -D -m 644 $< $@
$(DESTDIR)$(lincludedir)/%: $(ALL_INCLUDES)
install -D -m 644 $< $@
$(SONAME): $(LOBJS)
$(CC) $(PIC) -Wl,-soname=$(SONAME) -o $(SONAME) $(LOBJS) $(LDFLAGS)
$(ANAME): $(OBJS)
rm -f $@
$(AR) rc $@ $(OBJS)
$(RANLIB) $@
clean:
rm -f $(OBJS)
rm -f $(LOBJS)
rm -f $(EX_PROGS)
%.o: %.c config.mak
$(CC) $(CPPFLAGS) $(CFLAGS) $(INC) -c -o $@ $<
%.lo: %.c config.mak
$(CC) $(CPPFLAGS) $(CFLAGS) $(PIC) $(INC) -c -o $@ $<
examples/micserver.out: LDFLAGS+=-lasound
%.out: %.c $(ANAME)
$(CC) $(CPPFLAGS) $(CFLAGS) $(INC) -o $@ $< -L. -lrocksock $(LDFLAGS)
.PHONY: all clean install