📄 rules.mak
字号:
######################################################################### $Id: rules.mak,v 1.11 2007/06/28 05:11:36 aland Exp $## Each module should have a few common defines at the TOP of the# Makefile, and the 'include ../rules.mak'## e.g.############################ TARGET = rlm_foo# SRCS = rlm_foo.c other.c## include ../rules.mak## CFLAGS += my_c_flags############################ and everything will be automagically built########################################################################.PHONY: all build-module clean distclean install reconfigall: build-module######################################################################### definitions for new dependencies on suffixes########################################################################.SUFFIXES: .lo .o .la .a######################################################################### define libtool objects for the libraries,# along with a number of other useful definitions.########################################################################LT_OBJS = $(SRCS:.c=.lo)CFLAGS += -I../.. -I$(top_builddir)/src/######################################################################### Ensure that the modules get re-built if the server header files# change.########################################################################SERVER_HEADERS = ../../rlm_sql.h$(LT_OBJS): $(SERVER_HEADERS)######################################################################### define new rules########################################################################%.lo: %.c $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(RLM_SQL_CFLAGS) -c $<ifneq ($(TARGET),)######################################################################### Define a number of new targets########################################################################## If the module is in the list of static modules, then the "dynamic"# library is built statically, so that the '.la' file contains the# libraries that the module depends on.## Yes, this is a horrible hack.#ifeq ($(findstring $(TARGET),$(STATIC_MODULES)),)LINK_MODE=-export-dynamicelseLINK_MODE=-staticendif## Also, if we're NOT using shared libraries, then force the# link mode to static.#ifneq ($(USE_SHARED_LIBS),yes)LINK_MODE=-staticendif######################################################################### Generic targets so we can sweep through all modules# without knowing what their names are.## These rules also allow us to copy the '.a' or '.la' up# a level, to the 'src/modules' directory, for general consumption.########################################################################build-module: $(TARGET).la @[ -d .libs ] && cp .libs/* ../lib @cp $< ../lib$(TARGET).la: $(LT_OBJS) $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) \ -module $(LINK_MODE) $(LDFLAGS) $(RLM_SQL_LDFLAGS) -o $@ \ -rpath $(libdir) $^ $(RLM_SQL_LIBS)######################################################################### It's a dummy target: don't build it########################################################################elsebuild-module:# if $(TARGET) == ""endif######################################################################### clean and install rules########################################################################clean: @rm -f *.a *.o *.lo *.la *~ @rm -rf .libs _libs @rm -f config.log config.status config.cachedistclean: clean @rm -f config.h config.makreconfig: @if [ -f configure.in ]; then \ [ "x$(AUTOCONF)" != "x" ] && $(AUTOCONF) -I $(top_builddir); \ fi @if [ -f config.h.in ]; then \ [ "x$(AUTOHEADER)" != "x" ] && $(AUTOHEADER); \ fi## Do any module-specific installation.## If there isn't a TARGET defined, then don't do anything.# Otherwise, install the libraries into $(libdir)#install: if [ "x$(TARGET)" != "x" ]; then \ $(LIBTOOL) --mode=install $(INSTALL) -c \ $(TARGET).la $(R)$(libdir)/$(TARGET).la || exit $$?; \ rm -f $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la; \ ln -s $(TARGET).la $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la || exit $$?; \ fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -