-
Notifications
You must be signed in to change notification settings - Fork 18
/
GNUmakefile
89 lines (68 loc) · 1.77 KB
/
GNUmakefile
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
78
79
80
81
82
83
84
85
86
87
88
89
# config
-include Make.config
include mk/Variables.mk
TARGET := webfsd
OBJS := webfsd.o request.o response.o ls.o mime.o cgi.o
mimefile := "/etc/mime.types"
CFLAGS += -DMIMEFILE=\"$(mimefile)\"
CFLAGS += -DWEBFS_VERSION=\"$(VERSION)\"
CFLAGS += -D_GNU_SOURCE
CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
# default target
all: build
############################################################################
include mk/Autoconf.mk
define make-config
LIB := $(LIB)
SYSTEM := $(call ac_uname)
USE_SENDFILE := yes
USE_THREADS := no
USE_SSL := $(call ac_header,openssl/ssl.h)
USE_DIET := $(call ac_binary,diet)
endef
# sendfile yes/no
ifneq ($(USE_SENDFILE),yes)
CFLAGS += -DNO_SENDFILE
endif
# threads yes/no
ifeq ($(USE_THREADS)-$(SYSTEM),yes-linux)
CFLAGS += -DUSE_THREADS=1 -D_REENTRANT
LDLIBS += -lpthread
endif
ifeq ($(USE_THREADS)-$(SYSTEM),yes-freebsd)
CFLAGS += -DUSE_THREADS=1 -D_REENTRANT -pthread
endif
ifeq ($(USE_THREADS)-$(SYSTEM),yes-darwin)
CFLAGS += -DUSE_THREADS=1 -D_REENTRANT -pthread
endif
# OpenSSL yes/no
ifeq ($(USE_SSL),yes)
CFLAGS += -DUSE_SSL=1
OBJS += ssl.o
LDLIBS += -lssl -lcrypto
endif
# dietlibc yes/no
ifeq ($(USE_DIET),yes)
CC := diet $(CC)
endif
# solaris tweaks
ifeq ($(SYSTEM),sunos)
LDFLAGS += -L/usr/local/ssl/lib
LDLIBS += -lresolv -lsocket -lnsl
endif
#################################################################
# rules
build: $(TARGET)
$(TARGET): $(OBJS)
install: $(TARGET)
$(INSTALL_DIR) $(bindir)
$(INSTALL_BINARY) $(TARGET) $(bindir)
$(INSTALL_DIR) $(mandir)/man1
$(INSTALL_DATA) webfsd.man $(mandir)/man1/webfsd.1
clean:
rm -f *~ debian/*~ *.o $(depfiles)
realclean distclean: clean
rm -f $(TARGET) Make.config
include mk/Compile.mk
include mk/Maintainer.mk
-include mk/*.dep