File: GNUmakefile

package info (click to toggle)
webfs 1.21+ds1-12
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,188 kB
  • ctags: 1,570
  • sloc: ansic: 3,293; sh: 418; makefile: 20; perl: 7
file content (98 lines) | stat: -rw-r--r-- 2,002 bytes parent folder | download | duplicates (2)
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
90
91
92
93
94
95
96
97
98
# 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

export CPPFLAGS CFLAGS LDFLAGS

# default target
all: build


############################################################################

include mk/Autoconf.mk

define make-config
LIB          := $(LIB)
SYSTEM       := $(call ac_uname)
USE_SENDFILE := yes
USE_THREADS  := no
USE_GNUTLS   := $(call ac_header,gnutls/gnutls.h)
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_GNUTLS),yes)
COND_GCRYPT = $(shell if pkg-config --exists 'gnutls <= 2.11'; then echo '-lgcrypt'; fi)

USE_SSL = no
CFLAGS	+= -DUSE_GNUTLS=1
OBJS	+= ssl.o
LDLIBS	+= -lgnutls $(COND_GCRYPT)
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