Blob Blame History Raw
#
# 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.in 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/autofs.a

# 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) $(AUTOFS_LIB) $(LIBS)
	$(STRIP) $*.so