[go: up one dir, main page]

File: Makefile

package info (click to toggle)
stud 0.3-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 536 kB
  • sloc: ansic: 4,652; sh: 166; makefile: 77
file content (61 lines) | stat: -rw-r--r-- 1,518 bytes parent folder | download
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
# [g]make USE_xxxx=1
#
# USE_SHARED_CACHE   :   enable/disable a shared session cache (disabled by default)

DESTDIR =
PREFIX  = /usr/local
BINDIR  = $(PREFIX)/bin
MANDIR  = $(PREFIX)/share/man

CFLAGS  = $(shell dpkg-buildflags --get CPPFLAGS) $(shell dpkg-buildflags --get CFLAGS) -std=c99 -fno-strict-aliasing -Wall -W -D_GNU_SOURCE
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) -lssl -lcrypto -lev
OBJS    = stud.o ringbuffer.o

all: realall

# Shared cache feature
ifneq ($(USE_SHARED_CACHE),)
CFLAGS += -DUSE_SHARED_CACHE 
OBJS   += shctx.o ebtree/libebtree.a
ALL    += ebtree

DEB_HOST_ARCH ?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
#USE_SYSCALL_FUTEX depends on x86/x64 specific assembler code
#and afaict FUTEXes are linux-specific
ifeq ($(DEB_HOST_ARCH),i386)
CFLAGS += -DUSE_SYSCALL_FUTEX
else
ifeq ($(DEB_HOST_ARCH),amd64)
CFLAGS += -DUSE_SYSCALL_FUTEX
else
#we are on neither i396 or amd64, we need to link the pthread library
LDFLAGS += -lpthread
endif
endif

ebtree/libebtree.a: $(wildcard ebtree/*.c)
	make -C ebtree
ebtree:
	@[ -d ebtree ] || ( \
		echo "*** Download libebtree at http://1wt.eu/tools/ebtree/" ; \
		echo "*** Untar it and make a link named 'ebtree' to point on it"; \
		exit 1 )
endif

ALL += stud
realall: $(ALL)

stud: $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $^

install: $(ALL)
	install -d $(DESTDIR)$(BINDIR)
	install stud $(DESTDIR)$(BINDIR)
	install -d $(DESTDIR)$(MANDIR)/man8
	install -m 644 doc/stud.8 $(DESTDIR)$(MANDIR)/man8

clean:
	rm -f stud $(OBJS)


.PHONY: all realall