| 1 |
# -*- Mode: Makefile; indent-tabs-mode: nil -*- |
| 2 |
# vim: set filetype=makefile tabstop=8 shiftwidth=4 expandtab: |
| 3 |
|
| 4 |
# |
| 5 |
# Makefile for ECL |
| 6 |
# |
| 7 |
top_srcdir= @top_srcdir@ |
| 8 |
srcdir = @srcdir@ |
| 9 |
datarootdir = @datarootdir@ |
| 10 |
datadir = @datadir@ |
| 11 |
mandir=@mandir@ |
| 12 |
manext=1 |
| 13 |
|
| 14 |
# Programs used by "make": |
| 15 |
# |
| 16 |
|
| 17 |
@SET_MAKE@ |
| 18 |
# CC may be either C or CXX compiler (depending on --with-cxx |
| 19 |
# option). This compiler is used for building all contribs, modules |
| 20 |
# and anything what goes through CMP module. |
| 21 |
CC = @ECL_CC@ |
| 22 |
# TRUE_CC is always C compiler. ECL core files (src/c/*) doesn't build |
| 23 |
# with CXX compiler. |
| 24 |
TRUE_CC = @CC@ |
| 25 |
CFLAGS = -I. -I@true_builddir@ -I$(srcdir)/c -Iecl/gc \ |
| 26 |
-DECL_BUILD -DECL_API -DECL_NO_LEGACY \ |
| 27 |
@CPPFLAGS@ @CFLAGS@ @ECL_CFLAGS@ -c |
| 28 |
LIBS = @LIBS@ |
| 29 |
FASL_LIBS = @FASL_LIBS@ |
| 30 |
CORE_LIBS = @CORE_LIBS@ |
| 31 |
LDFLAGS = @LDFLAGS@ |
| 32 |
RM = @RM@ |
| 33 |
LN_S = @LN_S@ |
| 34 |
EXE = @EXEEXT@ |
| 35 |
CTAGS = @CTAGS@ |
| 36 |
ETAGS = @ETAGS@ |
| 37 |
RANLIB = @RANLIB@ |
| 38 |
AR = @AR@ |
| 39 |
ECL_MIN = @ECL_MIN@ |
| 40 |
DPP = dpp$(EXE) |
| 41 |
ECL = ecl$(EXE) |
| 42 |
|
| 43 |
# ==================== Where To Install Things ==================== |
| 44 |
|
| 45 |
# The default location for installation. Everything is placed in |
| 46 |
# subdirectories of this directory. The default values for many of |
| 47 |
# the variables below are expressed in terms of this one, so you may |
| 48 |
# not need to change them. This defaults to /usr/local. |
| 49 |
prefix=@prefix@ |
| 50 |
exec_prefix=@exec_prefix@ |
| 51 |
bindir=@bindir@ |
| 52 |
libdir=@libdir@ |
| 53 |
includedir=@includedir@ |
| 54 |
ecldir=@ecldir@ |
| 55 |
|
| 56 |
# Programs used by "make install": |
| 57 |
# |
| 58 |
SHELL = @SHELL@ |
| 59 |
INSTALL = @INSTALL@ |
| 60 |
INSTALL_DATA = @INSTALL_DATA@ |
| 61 |
INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
| 62 |
INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
| 63 |
INSTALL_LIBRARY = $(INSTALL_SCRIPT) |
| 64 |
INSTALL_DATA = @INSTALL_DATA@ |
| •65 |
mkinstalldirs = $(top_srcdir)/install.sh -d |
| 66 |
|
| 67 |
# Files |
| 68 |
|
| 69 |
SUBDIRS = @SUBDIRS@ |
| 70 |
LIBRARIES = @LIBRARIES@ |
| 71 |
LSP_LIBRARIES = @LSP_LIBRARIES@ |
| 72 |
TARGETS = @TARGETS@ |
| 73 |
ECL_CMPDIR = @ECL_CMPDIR@ |
| 74 |
|
| 75 |
all: $(TARGETS) bin/ecl-config .git/tags TAGS doc |
| 76 |
.PHONY: all |
| 77 |
.SUFFIXES: .c .o .d .s |
| 78 |
|
| 79 |
ifndef VERBOSE |
| 80 |
.SILENT: |
| 81 |
endif |
| 82 |
|
| 83 |
%Makefile: $(srcdir)/%Makefile.in config.status |
| 84 |
./config.status |
| 85 |
|
| 86 |
bin/$(ECL): $(ECL_MIN) compile.lsp build-stamp $(top_srcdir)/h/*.h $(top_srcdir)/h/impl/*.h $(top_srcdir)/lsp/*.lsp $(top_srcdir)/clos/*.lsp $(top_srcdir)/*cmp/*.lsp $(top_srcdir)/*cmp/*/*.lsp |
| 87 |
if [ -f CROSS-COMPILER ]; then \ |
| 88 |
./CROSS-COMPILER compile; \ |
| 89 |
else \ |
| 90 |
ECLDIR=`pwd`/ ./$(ECL_MIN) compile; \ |
| 91 |
fi |
| 92 |
if [ "x@SONAME@" != "x" -a -f "@SONAME@" -a "@SONAME@" != "@SONAME3@" ]; then \ |
| 93 |
( mv @SONAME@ @SONAME3@ && \ |
| 94 |
$(RM) -f @SONAME2@ @SONAME1@ @SONAME@ && \ |
| 95 |
$(LN_S) @SONAME3@ @SONAME2@ && \ |
| 96 |
$(LN_S) @SONAME3@ @SONAME1@ && \ |
| 97 |
$(LN_S) @SONAME3@ @SONAME@ ) \ |
| 98 |
fi |
| 99 |
|
| 100 |
# prerequisite libraries |
| 101 |
libeclgc.a: libeclatomic.a |
| 102 |
test -d ecl/gc || mkdir ecl/gc |
| 103 |
test -d ecl/gc/private || mkdir ecl/gc/private |
| 104 |
if (echo $(SUBDIRS) | grep gc); then \ |
| 105 |
cd gc && $(MAKE) install && cd .. && \ |
| 106 |
cp -rf $(srcdir)/@ECL_GC_DIR@/include/private/*.h ecl/gc/private/ && \ |
| 107 |
mv libgc.a libeclgc.a; \ |
| 108 |
fi |
| 109 |
libeclffi.a: |
| 110 |
if (echo $(SUBDIRS) | grep libffi); then \ |
| 111 |
cd libffi && $(MAKE) install && cd .. && \ |
| 112 |
sed -e 's,<ffitarget,<ecl/ffitarget,' ecl/ffi.h > ecl/foo.h && \ |
| 113 |
rm ecl/ffi.h && mv ecl/foo.h ecl/ffi.h && \ |
| 114 |
mv libffi.a libeclffi.a; \ |
| 115 |
fi |
| 116 |
libeclatomic.a: |
| 117 |
if (echo $(SUBDIRS) | grep atomic); then \ |
| 118 |
cd atomic && $(MAKE) && $(MAKE) install && cd .. && \ |
| 119 |
$(RM) -rf share ecl/atomic_ops_stack.h ecl/atomic_ops_malloc.h *atomic*gpl* && \ |
| 120 |
mv libatomic_ops.a libeclatomic.a; \ |
| 121 |
fi |
| 122 |
libeclgmp.a: |
| 123 |
if (echo $(SUBDIRS) | grep gmp); then \ |
| 124 |
cd gmp && $(MAKE) install && \ |
| 125 |
cd .. && mv include/gmp.h ecl/ && rmdir include && \ |
| 126 |
mv ./libgmp.a ./libeclgmp.a; \ |
| 127 |
fi |
| 128 |
|
| 129 |
# final objects archive |
| 130 |
libeclmin.a: libeclgmp.a libeclatomic.a libeclgc.a libeclffi.a lsp/config.lsp $(ECL_CMPDIR)/cmpdefs.lsp |
| 131 |
@echo "Building $@..." |
| 132 |
cd c; $(MAKE) |
| 133 |
|
| 134 |
$(ECL_MIN): $(LIBRARIES) .gdbinit libeclmin.a |
| 135 |
@echo "Building $@..." |
| 136 |
if [ -f CROSS-COMPILER ]; then \ |
| 137 |
touch $@; \ |
| 138 |
else \ |
| 139 |
$(CC) $(LDFLAGS) -o $@ \ |
| 140 |
cinit.o c/all_symbols.o \ |
| 141 |
-L./ libeclmin.a \ |
| 142 |
$(CORE_LIBS) $(FASL_LIBS) $(LIBS);\ |
| 143 |
fi |
| 144 |
mini_ecl: $(ECL_MIN) bare2.lsp |
| 145 |
(echo '#!/bin/sh'; echo './$(ECL_MIN) bare2.lsp') > $@ |
| 146 |
chmod +x $@ |
| 147 |
|
| 148 |
clean-ecl_min: |
| 149 |
$(RM) -rf $(DPP) $(ECL_MIN) libecl*.a c/ |
| 150 |
for i in $(srcdir)/c/*/; do mkdir -p c/`basename $$i`; done |
| 151 |
|
| 152 |
bare2.lsp: |
| 153 |
echo '(load "bare")(si::top-level)' > $@ |
| 154 |
|
| 155 |
.gdbinit: $(srcdir)/util/gdbinit |
| 156 |
cp $(srcdir)/util/gdbinit $@ |
| 157 |
|
| 158 |
$(ECL_CMPDIR)/cmpdefs.lsp: $(ECL_CMPDIR)/cmpdefs.pre |
| 159 |
sed -e 's,@ecldir\\@,$(ecldir),g' \ |
| 160 |
-e 's,@libdir\\@,$(libdir),g' \ |
| 161 |
-e 's,@includedir\\@,$(includedir),g' < $(ECL_CMPDIR)/cmpdefs.pre > $@ |
| 162 |
|
| 163 |
# @SONAME_LDFLAGS@ expansion may contain @libdir@ on OSX |
| 164 |
compile.lsp: compile.pre |
| 165 |
sed -e 's,@ecldir\\@,$(ecldir),g' \ |
| 166 |
-e 's,@libdir\\@,$(libdir),g' < compile.pre > compile.lsp |
| 167 |
|
| 168 |
bin/ecl-config: bin/ecl-config.pre |
| 169 |
sed -e 's,@libdir\\@,$(libdir),' \ |
| 170 |
-e 's,@includedir\\@,$(includedir),' \ |
| 171 |
-e 's,~A,$(libdir),' bin/ecl-config.pre > bin/ecl-config |
| 172 |
|
| 173 |
build-stamp: config.status |
| 174 |
echo "#" `uname -a` > $@ |
| 175 |
head -8 config.log | tail -6 >> $@ |
| 176 |
|
| 177 |
doc: |
| 178 |
$(MAKE) -C doc |
| 179 |
.PHONY: doc |
| 180 |
|
| 181 |
install: |
| 182 |
# Here we would use the option -s but the install program in sourceforge-solaris |
| 183 |
# is broken. |
| 184 |
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) \ |
| 185 |
$(DESTDIR)$(ecldir) $(DESTDIR)$(includedir) $(DESTDIR)$(includedir)/ecl |
| 186 |
for i in $(TARGETS); do \ |
| 187 |
$(INSTALL_PROGRAM) $$i $(DESTDIR)$(bindir); \ |
| 188 |
done |
| 189 |
if [ -d encodings ]; then \ |
| 190 |
$(mkinstalldirs) $(DESTDIR)$(ecldir)/encodings; \ |
| 191 |
for i in ./encodings/*; do \ |
| 192 |
$(INSTALL_DATA) $$i $(DESTDIR)$(ecldir)/encodings; \ |
| 193 |
done \ |
| 194 |
fi |
| 195 |
$(mkinstalldirs) $(DESTDIR)$(includedir)/ecl |
| 196 |
for i in `(cd ecl && find . -type d)`; do \ |
| 197 |
k="$(DESTDIR)$(includedir)/ecl/$$i"; \ |
| 198 |
test -d "$$k" || $(mkinstalldirs) $$k; \ |
| 199 |
done |
| 200 |
for i in `(cd ecl && find . -name '*.h')`; do echo $$i; \ |
| 201 |
$(INSTALL_DATA) ecl/$$i $(DESTDIR)$(includedir)/ecl/$$i; \ |
| 202 |
done |
| 203 |
$(INSTALL_SCRIPT) bin/ecl-config $(DESTDIR)$(bindir) |
| 204 |
for i in build-stamp help.doc TAGS ; do \ |
| 205 |
$(INSTALL_DATA) $$i $(DESTDIR)$(ecldir); \ |
| 206 |
done |
| 207 |
for i in $(LSP_LIBRARIES) $(LIBRARIES); do \ |
| 208 |
if test -s $$i ; then \ |
| 209 |
if echo $$i | grep dll; then \ |
| 210 |
$(INSTALL_LIBRARY) $$i $(DESTDIR)$(bindir); \ |
| 211 |
fi; \ |
| 212 |
$(INSTALL_LIBRARY) $$i $(DESTDIR)$(libdir); \ |
| 213 |
fi \ |
| 214 |
done |
| 215 |
if [ "x@SONAME3@" != "x" -a -f "@SONAME3@" -a "@SONAME@" != "@SONAME3@" ]; then \ |
| 216 |
( $(INSTALL_LIBRARY) @SONAME3@ $(DESTDIR)$(libdir) && \ |
| 217 |
cd $(DESTDIR)$(libdir) && $(RM) -f @SONAME2@ @SONAME1@ @SONAME@ && \ |
| 218 |
$(LN_S) @SONAME3@ @SONAME2@ && \ |
| 219 |
$(LN_S) @SONAME3@ @SONAME1@ && \ |
| 220 |
$(LN_S) @SONAME3@ @SONAME@ ) \ |
| 221 |
fi |
| 222 |
$(INSTALL_PROGRAM) c/$(DPP) $(DESTDIR)$(ecldir) |
| 223 |
$(INSTALL_PROGRAM) $(ECL_MIN) $(DESTDIR)$(ecldir) |
| 224 |
for i in `cat modules`; do \ |
| 225 |
case $$i in \ |
| 226 |
*.fas) $(INSTALL_PROGRAM) $$i $(DESTDIR)$(ecldir);; \ |
| 227 |
*) $(INSTALL_DATA) $$i $(DESTDIR)$(ecldir);; \ |
| 228 |
esac \ |
| 229 |
done |
| 230 |
for i in LICENSE COPYING; do \ |
| 231 |
$(INSTALL_DATA) $(top_srcdir)/../$$i $(DESTDIR)$(ecldir); \ |
| 232 |
done |
| 233 |
$(MAKE) -C doc install |
| 234 |
|
| 235 |
flatinstall: build-stamp |
| 236 |
$(MAKE) DESTDIR=$(DESTDIR) bindir=$(prefix) libdir=$(prefix) \ |
| 237 |
includedir=$(prefix) ecldir=$(prefix) install |
| 238 |
|
| 239 |
uninstall: |
| 240 |
for i in $(ECL) ecl-config; do $(RM) $(DESTDIR)$(bindir)/$$i; done |
| 241 |
for i in $(LSP_LIBRARIES) $(LIBRARIES) LICENSE LGPL \ |
| 242 |
@SONAME@ @SONAME1@ @SONAME2@ @SONAME3@; do \ |
| 243 |
$(RM) $(DESTDIR)$(libdir)/$$i || : ; \ |
| 244 |
done |
| 245 |
$(MAKE) -C doc uninstall |
| 246 |
$(RM) -r $(DESTDIR)$(includedir)/ecl $(DESTDIR)$(ecldir) |
| 247 |
|
| 248 |
clean: mostlyclean |
| 249 |
$(RM) -r * |
| 250 |
mostlyclean: clean-ecl_min clean_lisp |
| 251 |
(cd tests && $(MAKE) clean) |
| 252 |
-for i in $(SUBDIRS); do (test -d $$i && cd $$i && $(MAKE) clean); done |
| 253 |
$(RM) -r $(ECL_MIN) $(ECL) help.doc core a.out TAGS |
| 254 |
$(RM) config.version config.log config.cache |
| 255 |
$(RM) *.c *.o *.a *.eclh *.h *.data *.fas *.dat *.la *.so *.dylib |
| 256 |
clean_lisp: |
| 257 |
-$(RM) help.doc $(TARGETS) |
| 258 |
-for i in lsp cmp clos tk ext; do $(RM) lib$$i.a $$i/?*.{o,eclh,data,c,sdat,h,fas}; done |
| 259 |
distclean: clean |
| 260 |
realclean: distclean |
| 261 |
# |
| 262 |
# Rebuild ECL using recent changes and compare |
| 263 |
# |
| 264 |
test_changes: |
| 265 |
test -d old || mkdir old |
| 266 |
cp -rf lsp clos cmp old/ |
| 267 |
$(MAKE) clean_lisp; $(MAKE) -C c clean; $(RM) -f $(ECL) |
| 268 |
$(MAKE) |
| 269 |
for i in lsp clos cmp; do diff --exclude=\*.o $$i old/$$i; done |
| 270 |
# |
| 271 |
# Run test suite |
| 272 |
# |
| 273 |
check: |
| 274 |
cd tests && $(MAKE) clean && $(MAKE) check TESTS="$(TESTS)" |
| 275 |
|
| 276 |
ansi-test: |
| 277 |
cd tests && $(MAKE) clean && $(MAKE) ansi-test |
| 278 |
|
| 279 |
# |
| 280 |
# Rebuild ECL using its own image and compare. Does not work |
| 281 |
# right now. |
| 282 |
# |
| 283 |
selfbuild: |
| 284 |
exit 2 |
| 285 |
test -d stage2 || mkdir stage2 |
| 286 |
cp -rf lsp clos cmp stage2 |
| 287 |
-for i in lsp cmp clos tk; do test -f lib$$i.a && mv lib$$i.a stage2; done |
| 288 |
$(MAKE) clean_lisp |
| 289 |
./ecl compile |
| 290 |
-for i in lsp clos cmp tk; do test -d $$i && diff --exclude=\*.o $$i stage2/$$i; done | less |
| 291 |
|
| 292 |
.git/tags: |
| 293 |
( cd $(srcdir)/../.git && test "x$(CTAGS)" != "x" && $(CTAGS) -f tags -R --langmap=c:+.d ../src || false) || echo "tags generation failed, but this does not break the build." |
| 294 |
|
| 295 |
# Make sure to also include *.d files; and match DPP's idiosyncracies |
| 296 |
# like "@si::foo" and "@(defun si::foo". This rule is allowed to fail |
| 297 |
# when etags does not exist. |
| 298 |
TAGS: |
| 299 |
-if test "x$(ETAGS)" != "x"; then \ |
| 300 |
srcfiles=`find $(srcdir)/c $(srcdir)/h -name '*.[chd]'` && \ |
| 301 |
$(ETAGS) --language=c -o $@ $$srcfiles && \ |
| 302 |
$(ETAGS) --language=none -o $@ --append \ |
| 303 |
--regex='/@\([-:*a-zA-z]+\)/\1/' \ |
| 304 |
--regex='/@(defun \([-:*a-zA-z]+\)/\1/' \ |
| 305 |
$$srcfiles; \ |
| 306 |
fi |
| 307 |
touch $@ |