-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.am
238 lines (197 loc) · 6.18 KB
/
Makefile.am
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# Add the m4 directory to the include path for aclocal
ACLOCAL_AMFLAGS=-I m4
# Set up global variables
LIBNAME = parlib
CAP_LIBNAME = $(shell echo $(LIBNAME) | sed -e 's/^[a-z]/\U&/g')
SRCDIR = $(srcdir)/@SRCDIR@
# List of C FILES to build into objects
LIB_CFILES = \
@SRCDIR@/mcs.c \
@SRCDIR@/slab.c \
@SRCDIR@/tls.c \
@SRCDIR@/dtls.c \
@SRCDIR@/pool.c \
@SRCDIR@/pthread_pool.c \
@SRCDIR@/uthread.c \
@SRCDIR@/syscall.c \
@SRCDIR@/syscall_real.c \
@SRCDIR@/event.c \
@SRCDIR@/alarm.c \
@SRCDIR@/vcore.c \
@SRCDIR@/parlib.c \
@SRCDIR@/timing.c \
@SRCDIR@/waitfreelist.c
LIB_HFILES = \
$(LIBNAME)-config.h \
@SRCDIR@/spinlock.h \
@SRCDIR@/parlib.h \
@SRCDIR@/common.h \
@SRCDIR@/mcs.h \
@SRCDIR@/slab.h \
@SRCDIR@/pool.h \
@SRCDIR@/tls.h \
@SRCDIR@/dtls.h \
@SRCDIR@/uthread.h \
@SRCDIR@/event.h \
@SRCDIR@/alarm.h \
@SRCDIR@/vcore.h \
@SRCDIR@/export.h \
@SRCDIR@/context.h \
@SRCDIR@/timing.h \
@SRCDIR@/waitfreelist.h
LIB_SFILES =
LIB_INTERNAL_FILES = \
@SRCDIR@/internal/parlib.h \
@SRCDIR@/internal/futex.h \
@SRCDIR@/internal/glibc-tls.h \
@SRCDIR@/internal/tls.h \
@SRCDIR@/internal/dtls.h \
@SRCDIR@/internal/pthread_pool.h \
@SRCDIR@/internal/uthread.h \
@SRCDIR@/internal/syscall.h \
@SRCDIR@/internal/time.h \
@SRCDIR@/internal/vcore.h
if ARCH_i686
SYSDEPDIR = $(srcdir)/@SYSDEPDIR_i686@
LIB_SFILES += \
@SYSDEPDIR_i686@/reenter.S \
@SYSDEPDIR_i686@/swapcontext.S \
@SYSDEPDIR_i686@/setcontext.S \
@SYSDEPDIR_i686@/getcontext.S
LIB_HFILES += \
@SYSDEPDIR_i686@/arch.h \
@SYSDEPDIR_i686@/atomic.h
LIB_INTERNAL_FILES += \
@SYSDEPDIR_i686@/internal/asm.h
endif
if ARCH_x86_64
SYSDEPDIR = $(srcdir)/@SYSDEPDIR_x86_64@
LIB_SFILES += \
@SYSDEPDIR_x86_64@/reenter.S \
@SYSDEPDIR_x86_64@/swapcontext.S \
@SYSDEPDIR_x86_64@/setcontext.S \
@SYSDEPDIR_x86_64@/getcontext.S
LIB_HFILES += \
@SYSDEPDIR_x86_64@/arch.h \
@SYSDEPDIR_x86_64@/ucontext.h \
@SYSDEPDIR_x86_64@/atomic.h
LIB_INTERNAL_FILES += \
@SYSDEPDIR_x86_64@/internal/asm.h
endif
LIB_FILES = $(LIB_CFILES) $(LIB_SFILES) $(LIB_HFILES) $(LIB_INTERNAL_FILES)
# Setup parameters to build the library
lib_LTLIBRARIES = libparlib.la
libparlib_la_CFLAGS = $(LIB_CFLAGS)
libparlib_la_CPPFLAGS = -I$(SYSDEPDIR) -I$(srcdir)/src -DCOMPILING_PARLIB
libparlib_la_SOURCES = $(LIB_FILES)
libparlib_la_LIBADD = -lpthread -lrt
libparlib_la_LDFLAGS = -Wl,-wrap,socket
libparlib_la_LDFLAGS += -Wl,-wrap,accept
if STATIC_ONLY
libparlib_la_LDFLAGS += -all-static
endif
# Setup a directory where all of the include files will be installed
parlibincdir = $(includedir)/$(LIBNAME)
dist_parlibinc_DATA = $(LIB_HFILES)
# Setup parameters to build the test programs
check_PROGRAMS = lock_test vcore_test pool_test slab_test pthread_pool_test alarm_test signal_test wfl_test
lock_test_SOURCES = @TESTSDIR@/lock_test.c
lock_test_CFLAGS = $(TEST_CFLAGS)
lock_test_CFLAGS += -I$(SRCDIR) -I$(SYSDEPDIR)
lock_test_LDADD = libparlib.la
vcore_test_SOURCES = @TESTSDIR@/vcore_test.c
vcore_test_CFLAGS = $(TEST_CFLAGS)
vcore_test_CFLAGS += -I$(SRCDIR) -I$(SYSDEPDIR)
vcore_test_LDADD = libparlib.la
pool_test_SOURCES = @TESTSDIR@/pool_test.c
pool_test_CFLAGS = $(TEST_CFLAGS)
pool_test_CFLAGS += -I$(SRCDIR) -I$(SYSDEPDIR)
pool_test_LDADD = libparlib.la
slab_test_SOURCES = @TESTSDIR@/slab_test.c
slab_test_CFLAGS = $(TEST_CFLAGS)
slab_test_CFLAGS += -I$(SRCDIR) -I$(SYSDEPDIR)
slab_test_LDADD = libparlib.la
pthread_pool_test_SOURCES = @TESTSDIR@/pthread_pool_test.c
pthread_pool_test_CFLAGS = $(TEST_CFLAGS)
pthread_pool_test_CFLAGS += -I$(SRCDIR) -I$(SYSDEPDIR)
pthread_pool_test_LDADD = libparlib.la
alarm_test_SOURCES = @TESTSDIR@/alarm_test.c
alarm_test_CFLAGS = $(TEST_CFLAGS)
alarm_test_CFLAGS += -I$(SRCDIR) -I$(SYSDEPDIR)
alarm_test_LDADD = libparlib.la
signal_test_SOURCES = @TESTSDIR@/signal_test.c
signal_test_CFLAGS = $(TEST_CFLAGS)
signal_test_CFLAGS += -I$(SRCDIR) -I$(SYSDEPDIR)
signal_test_LDADD = libparlib.la -lpthread
wfl_test_SOURCES = @TESTSDIR@/wfl_test.c
wfl_test_CFLAGS = $(TEST_CFLAGS)
wfl_test_CFLAGS += -I$(SRCDIR) -I$(SYSDEPDIR)
wfl_test_LDADD = libparlib.la
if SPHINX_BUILD
man_MANS = \
doc/man/$(LIBNAME).1
# Don't suppport doing things this way for now because automake is dumb and
# doesn't allow 'generated' texi files...
# Instead we'll add the generated .info file and install it manually...
#info_TEXINFOS = \
# doc/texinfo/$(CAP_LIBNAME).texi
# Include pre-generated documentation in the distribution
EXTRA_DIST = \
doc/html \
doc/singlehtml \
doc/man \
doc/texinfo/$(CAP_LIBNAME).info \
doc/latex/$(CAP_LIBNAME).pdf
$(abs_builddir)/doc/%: | $(abs_builddir)/doc
cd $(srcdir)/doc; \
if [ -f Makefile ]; then \
make BUILDDIR=$(abs_builddir)/doc $(@F); \
else \
cp -R $(@F) $(@D); \
fi;
$(abs_builddir)/doc/texinfo/$(CAP_LIBNAME).info: | $(abs_builddir)/doc
cd $(srcdir)/doc; \
if [ -f Makefile ]; then \
make BUILDDIR=$(abs_builddir)/doc info; \
else \
cp -R texinfo $(@D); \
fi;
$(abs_builddir)/doc/latex/$(CAP_LIBNAME).pdf: | $(abs_builddir)/doc
cd $(srcdir)/doc; \
if [ -f Makefile ]; then \
make BUILDDIR=$(abs_builddir)/doc latexpdf; \
else \
cp -R latex $(@D); \
fi;
$(abs_builddir)/doc:
mkdir -p $@
doc/%: $(abs_builddir)/doc/%
doc/man/$(LIBNAME).1: $(abs_builddir)/doc/man
doc/texinfo/$(CAP_LIBNAME).info: $(abs_builddir)/doc/texinfo/$(CAP_LIBNAME).info
doc/latex/$(CAP_LIBNAME).pdf: $(abs_builddir)/doc/latex/$(CAP_LIBNAME).pdf
doc: \
$(abs_builddir)/doc/html \
$(abs_builddir)/doc/singlehtml \
$(abs_builddir)/doc/man \
$(abs_builddir)/doc/texinfo/$(CAP_LIBNAME).info \
$(abs_builddir)/doc/latex/$(CAP_LIBNAME).pdf
clean-local:
rm -rf doc
install-data-hook: doc
install -d $(docdir)
install -d $(infodir)
cp -r $(abs_builddir)/doc/html $(docdir)
cp -r $(abs_builddir)/doc/singlehtml $(docdir)
cp -r $(abs_builddir)/doc/texinfo/$(CAP_LIBNAME).info $(infodir)
cp -r $(abs_builddir)/doc/latex/$(CAP_LIBNAME).pdf $(docdir)
endif
ChangeLog:
cd $(srcdir); \
if [ -f git-changelog.sh ]; then \
./git-changelog.sh; \
fi;
uninstall-hook:
rm -rf $(parlibincdir)
rm -rf $(docdir)
rm -rf $(infodir)/$(CAP_LIBNAME).info
.PHONY: ChangeLog