aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.rules
blob: 6ce39e5414379368128c978e59cb6f5aa52256cb (plain)
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
#
# Makefile rules for autofs project
#

# Root directory contents
SUBDIRS = lib daemon modules man
INCDIRS = include
INCFILES = COPYING COPYRIGHT NEWS README* TODO Makefile Makefile.rules \
	   Makefile.conf.in .version .autofs-* configure.ac aclocal.m4 \
	   configure *.patch autofs.spec

ifeq ($(FEDFS), 1)
	SUBDIRS += fedfs
endif

# Attempt to be friends with autotools
INSTALLROOT = $(DESTDIR)

# autofs utility library
AUTOFS_LIB      = ../lib/libautofs.so
AUTOFS_LIB_LINK = -L../lib -lautofs

# Compilers, linkers and flags
# The STRIP defined here *must not* remove any dynamic-loading symbols

ifdef DMALLOCLIB
DEBUG=1
endif

ifdef DEBUG
CFLAGS    ?= -g -Wall -DDEBUG
LDFLAGS   ?= -g
else
CFLAGS    ?= -O2 -Wall
LDFLAGS   ?= -s
endif

ifdef DONTSTRIP
STRIP     ?= :
else
STRIP     ?= strip --strip-debug
endif

CC        ?= gcc
CXX       ?= g++
CXXFLAGS  ?= $(CFLAGS)
LD        ?= ld
SOLDFLAGS = -shared

CFLAGS += -D_REENTRANT -D_FILE_OFFSET_BITS=64
LIBS += -lpthread

ifdef TIRPCLIB
CFLAGS += $(TIRPCCFLAGS)
LIBS += $(TIRPCLIB)
endif

ifdef DMALLOCLIB
LIBS += $(DMALLOCLIB)
endif

LIBS += $(LIBCLOCK_GETTIME)

# Standard rules

.SUFFIXES: .c .o .s .so

.c.o:
	$(CC) $(CFLAGS) -c $<

.c.s:
	$(CC) $(CFLAGS) -S $<

.c.so:
	$(CC) $(SOLDFLAGS) $(CFLAGS) -o $*.so $< $(LDFLAGS) $(LIBS) $(AUTOFS_LIB_LINK)
	$(STRIP) $*.so