~ubuntu-branches/ubuntu/feisty/freeradius/feisty-security

« back to all changes in this revision

Viewing changes to src/modules/rules.mak

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-12-16 20:45:11 UTC
  • mfrom: (3.1.10 feisty)
  • Revision ID: james.westby@ubuntu.com-20061216204511-3pbbsu4s8jtehsor
Tags: 1.1.3-3
Fix POSIX compliance problem in init script.  Closes: #403384. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#######################################################################
2
2
#
3
 
# $Id: rules.mak,v 1.49 2002/08/06 16:11:39 aland Exp $
 
3
# $Id: rules.mak,v 1.49.6.2.2.4 2006/07/06 16:42:57 aland Exp $
4
4
#
5
5
#  Each module should have a few common defines at the TOP of the
6
6
# Makefile, and the 'include ../rules.mak'
7
7
#
8
8
# e.g.
9
9
#
10
 
##########################
 
10
############################
11
11
# TARGET = rlm_foo
12
12
# SRCS   = rlm_foo.c other.c
13
13
#
14
14
# include ../rules.mak
15
15
#
16
 
# CFLAGS += my_c_flags
17
 
##########################
 
16
# RLM_CFLAGS = my_cflags
 
17
# RLM_LDLAGS = my_ldflags
 
18
############################
18
19
#
19
20
# and everything will be automagically built
20
21
#
22
23
 
23
24
include $(RLM_DIR)../../../Make.inc
24
25
 
25
 
all: static dynamic
 
26
.PHONY: all build-module clean distclean install reconfig
 
27
 
 
28
all: build-module
26
29
 
27
30
#######################################################################
28
31
#
33
36
 
34
37
#######################################################################
35
38
#
36
 
# define static and dynamic objects for the libraries,
 
39
# define libtool objects for the libraries,
37
40
# along with a number of other useful definitions.
38
41
#
39
42
#######################################################################
40
 
STATIC_OBJS     += $(SRCS:.c=.o)
41
 
DYNAMIC_OBJS    += $(SRCS:.c=.lo)
42
 
CFLAGS          += -I$(RLM_DIR)../../include
 
43
LT_OBJS         += $(SRCS:.c=.lo)
 
44
LT_OBJS         += $(SRCS:.cpp=.lo)
 
45
CFLAGS          += -I$(top_builddir)/src/include
43
46
 
44
47
#######################################################################
45
48
#
47
50
# change.
48
51
#
49
52
#######################################################################
50
 
SERVER_HEADERS  = $(RLM_DIR)../../include/radiusd.h $(RLM_DIR)../../include/radius.h $(RLM_DIR)../../include/modules.h
51
 
$(STATIC_OBJS):  $(SERVER_HEADERS)
52
 
$(DYNAMIC_OBJS): $(SERVER_HEADERS)
 
53
SERVER_HEADERS  = $(top_builddir)/src/include/radius.h  \
 
54
                  $(top_builddir)/src/include/radiusd.h \
 
55
                  $(top_builddir)/src/include/modules.h
 
56
 
 
57
$(LT_OBJS): $(SERVER_HEADERS)
53
58
 
54
59
#######################################################################
55
60
#
56
61
# define new rules
57
62
#
58
63
#######################################################################
59
 
%.o : %.c
60
 
        $(CC) $(CFLAGS) $(RLM_CFLAGS) -c $< -o $@
61
 
 
62
 
%.lo : %.c
 
64
%.lo: %.c
63
65
        $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(RLM_CFLAGS) -c $<
64
66
 
 
67
%.lo: %.cpp
 
68
        $(LIBTOOL) --mode=compile $(CXX) $(CFLAGS) $(RLM_CFLAGS) -c $<
 
69
 
65
70
ifneq ($(TARGET),)
66
71
#######################################################################
67
72
#
68
73
# Define a number of new targets
69
74
#
70
75
#######################################################################
71
 
$(TARGET).a: $(STATIC_OBJS)
72
 
        $(LIBTOOL) --mode=link $(LD) \
73
 
        -module -static $(CFLAGS) $(RLM_CFLAGS) $^ -o $@ 
74
76
 
75
77
#
76
78
#  If the module is in the list of static modules, then the "dynamic"
80
82
#  Yes, this is a horrible hack.
81
83
#
82
84
ifeq ($(findstring $(TARGET),$(STATIC_MODULES)),)
83
 
LINK_MODE=-export-dynamic
 
85
LINK_MODE = -export-dynamic
84
86
else
85
 
LINK_MODE=-static
 
87
LINK_MODE = -static
86
88
endif
87
89
 
88
90
#
90
92
#  link mode to static.
91
93
#
92
94
ifneq ($(USE_SHARED_LIBS),yes)
93
 
LINK_MODE=-static
 
95
LINK_MODE = -static
94
96
endif
95
97
 
96
 
$(TARGET).la: $(DYNAMIC_OBJS)
97
 
        $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) \
98
 
        -module $(LINK_MODE) $(CFLAGS) $(RLM_CFLAGS) $(RLM_LDFLAGS) \
99
 
        -o $@ -rpath $(libdir) $^ $(RLM_LIBS) $(LIBS)
100
 
 
101
98
#######################################################################
102
99
#
103
100
#  Generic targets so we can sweep through all modules
107
104
# a level, to the 'src/modules' directory, for general consumption.
108
105
#
109
106
#######################################################################
110
 
static: $(TARGET).a  $(RLM_UTILS)
111
 
        @[ "x$(RLM_SUBDIRS)" = "x" ] || $(MAKE) $(MFLAGS) WHAT_TO_MAKE=static common
112
 
        @cp $< $(top_builddir)/src/modules/lib
113
 
 
114
 
dynamic: $(TARGET).la $(RLM_UTILS)
115
 
        @[ "x$(RLM_SUBDIRS)" = "x" ] || $(MAKE) $(MFLAGS) WHAT_TO_MAKE=dynamic common
116
 
        @cp $< $(top_builddir)/src/modules/lib
 
107
 
 
108
build-module: $(TARGET).la $(RLM_UTILS)
 
109
        @[ "x$(RLM_SUBDIRS)" = "x" ] || $(MAKE) $(MFLAGS) WHAT_TO_MAKE=all common
 
110
        @[ -d .libs ] && cp .libs/* $(top_builddir)/src/modules/lib
 
111
        @cp $< $(top_builddir)/src/modules/lib
 
112
 
 
113
$(TARGET).la: $(LT_OBJS)
 
114
        $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) \
 
115
        -module $(LINK_MODE) $(LDFLAGS) $(RLM_LDFLAGS) -o $@     \
 
116
        -rpath $(libdir) $^ $(top_builddir)/src/lib/libradius.la \
 
117
        $(RLM_LIBS) $(LIBS)
117
118
 
118
119
#######################################################################
119
120
#
121
122
#
122
123
#######################################################################
123
124
else
124
 
static:
125
 
 
126
 
dynamic:
 
125
build-module:
127
126
 
128
127
# if $(TARGET) == ""
129
128
endif
144
143
        @test -f Makefile.in && rm -f Makefile
145
144
 
146
145
reconfig:
147
 
        @[ "x$(AUTOCONF)" != "x" ] && [ -f ./configure.in ] && $(AUTOCONF) -l $(RLM_DIR)../../..
148
 
        @[ "x$(AUTOHEADER)" != "x" ] && [ -f ./config.h.in ] && $(AUTOHEADER)
 
146
        @if [ -f configure.in ]; then \
 
147
                [ "x$(AUTOCONF)" != "x" ] && $(AUTOCONF) -I $(top_builddir); \
 
148
        fi
 
149
        @if [ -f config.h.in ]; then \
 
150
                [ "x$(AUTOHEADER)" != "x" ] && $(AUTOHEADER); \
 
151
        fi
 
152
                
149
153
 
150
154
#
151
155
#  Do any module-specific installation.
154
158
#  Otherwise, install the libraries into $(libdir)
155
159
#
156
160
install:
 
161
        @[ "x$(RLM_INSTALL)" = "x" ] || $(MAKE) $(MFLAGS) $(RLM_INSTALL)
157
162
        if [ "x$(TARGET)" != "x" ]; then \
158
163
            $(LIBTOOL) --mode=install $(INSTALL) -c \
159
 
                $(TARGET).la $(R)$(libdir)/$(TARGET).la; \
 
164
                $(TARGET).la $(R)$(libdir)/$(TARGET).la || exit $$?; \
160
165
            rm -f $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la; \
161
 
            ln -s $(TARGET).la $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la; \
 
166
            ln -s $(TARGET).la $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la || exit $$?; \
162
167
        fi
163
 
        @[ "x$(RLM_INSTALL)" = "x" ] || $(MAKE) $(MFLAGS) $(RLM_INSTALL)