comparison doc/README.Generic @ 0:3e629dc19168

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:24:28 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3e629dc19168
1 Building DynCall with generic makefiles
2 =======================================
3
4
5 Description
6 -----------
7
8 Makefile.generic is a simple and _hybrid_ make-based build system setup for dyncall,
9 designed to work with with GNU and BSD make.
10
11 This build-flavour supports two operating modes: Embedded and Configure.
12
13 Project files are specified in Makefile.generic.
14
15
16 History
17 -------
18 During the integration of dyncall into the R package rdyncall, there
19 was a need for a clean simple build system that could be launched from R
20 and works with various make's such as GNU, BSD and sun make.
21
22
23 Generic Usage
24 -------------
25
26 [g|bsd]make [-f Makefile.generic] [all|clean|install|...] [INSTALL_TOP=<path>]
27
28
29 Embedded Mode
30 -------------
31 Makefile.generic makefiles are taken "as-is" without the need for extra configuration.
32
33 <VAR1>=<VALUE1> ... bsdmake -f Makefile.generic
34 <VAR1>=<VALUE1> ... gmake -f Makefile.generic
35
36 (Note that setting an env var as above (<VAR1>=<VALUE1>) before running a command is
37 shell specific. If your shell doesn't support this, set it according to the shell's
38 style.)
39
40 Example:
41 dyncall libraries should compile fine on most platforms:
42
43 BSDmake:
44 $ bsdmake -f Makefile.generic
45
46 GNUmake:
47 $ make -f Makefile.generic
48
49 The tests sometimes require special attention to additional 'usual' libraries
50 such as math and dynamic linker run-time libs.
51 $ LDLIBS="-lm -ldl" make -f Makefile.generic
52
53
54 Configure Mode
55 --------------
56
57 Usage:
58
59 cd <build-dir> # build-dir can be arbitrary
60 ../<path-to-source>/configure [--prefix=<path>]
61 make
62 make install [DESTDIR=<path>]
63
64 The configure script 'configure' writes 'Makefile' files that
65 include 'Makefile.generic' and setup variables such as
66 VPATH, {SRC,BLD}{TOP,DIR}.
67
68 Two build types are supported: In-source and out-of-Source.
69
70 in-source builds:
71 Makefile's are created in parallel to the Makefile.generic files.
72
73 out-of-source builds:
74 the configure script is executed from a (possible empty) build directory.
75 The source directory tree is duplicated into that directory.
76
77
78 Useful Variables
79 ----------------
80
81 For libraries:
82 CC, CFLAGS, CPPFLAGS
83 For tests:
84 CXX, LDLIBS
85
86 MAKE_CMD - The make tool (including -f flag) to run sub-directories.
87 SRCTOP - Source top-level directory (defaults to relative top).
88 BLDTOP - Build top-level directory (defaults to SRCTOP).
89 SRCDIR - Source directory (defaults to '.').
90 BLDDIR - Build directory (defaults to SRCDIR).
91
92 e.g. Makefile.generic in source-tree:
93
94 SRCTOP ?= ../../../ # relative path to source-top
95 BLDTOP ?= ${SRCTOP} # defaults for in-source builds
96 SRCDIR ?= . # relative path to current directory
97 BLDDIR ?= ${BLDDIR} # relative path to current directory
98
99
100 Include Directories
101 -------------------
102 Use -I${SRCTOP}/... to refer to other include directories.
103
104
105 Link Directories
106 ----------------
107 Use -L${BLDTOP}/... to refer to other build directories.
108
109
110 Plaform Notes:
111 --------------
112 Linux:
113 - all: ok.
114 make -f Makefile.generic all
115 - tests: need 'm' and 'dl' libs.
116 ( cd tests ; LDLIBS="-lm -ldl" make -f Makefile.generic )
117 - see batch script: buildsys/scripts/batch-build-linux.sh
118
119 Minix: No dynload support. No '-fPIC' is allowed.
120 - dynload: unsupport, no dynamic linker present in Minix 3.
121 - dyn{call,callback}: ok, without '-fPIC'!
122 ( cd dyncall ; CFLAGS= make -f Makefile.generic dyncall dyncallback )
123 - tests: ok
124 ( cd test ; make -f Makefile.generic all-dyncall all-dyncallback )
125 - see batch script: buildsys/scripts/batch-build-minix.sh
126
127 NetBSD/FreeBSD:
128 - all: ok.
129 make -f Makefile.generic all
130 - tests: need math lib:
131 ( cd tests ; LDLIBS="-lm" make -f Makefile.generic )
132
133 OpenBSD:
134 - all: ok.
135 make -f Makefile.generic all
136 - tests: *.cpp implicit rule not set, therefore only c tests work:
137 ( cd tests ; LDLIBS="-lm" make -f Makefile.generic all-c )
138 - install: ok.
139
140 Haiku Alpha 2:
141 - dynload: elf.h header found, install system source for dynload support
142 - dyn{call,callback}: ok.
143 make -f Makefile.generic dyncall dyncallback
144 - tests: ok
145 ( cd test ; make -f Makefile.generic all-dyncall all-dyncallback )
146
147
148 Build notes related to dyncall:
149 -------------------------------
150
151 CFLAGS
152 Use '-fPIC' for at least 64-bit systems and when you want the code to be
153 included as a shared library or module image.
154 LDLIBS
155 Use '-lm' for test/suite - it uses pow function.
156 Use '-ldl' for dynload examples such as test/nm and test/resolve_self on Linux.
157
158
159 Feature:
160 --------
161 configure --prefix=<prefix> -> Makefile DESTDIR=variable
162 make -f Makefile.generic DESTDIR=<prefix>
163
164
165 Todo:
166 -----
167 - sun's make: CXX does not exist.. no rule for *.cpp files but *.cc.
168