File: README.Generic

package info (click to toggle)
nqp 2014.07-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,596 kB
  • ctags: 7,993
  • sloc: ansic: 22,689; java: 20,240; cpp: 4,956; asm: 3,976; perl: 950; python: 267; sh: 245; makefile: 14
file content (168 lines) | stat: -rw-r--r-- 4,610 bytes parent folder | download
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
Building DynCall with generic makefiles
=======================================


Description
-----------

Makefile.generic is a simple and _hybrid_ make-based build system setup for dyncall, 
designed to work with with GNU and BSD make.

This build-flavour supports two operating modes: Embedded and Configure.

Project files are specified in Makefile.generic.


History
-------
During the integration of dyncall into the R package rdyncall, there
was a need for a clean simple build system that could be launched from R
and works with various make's such as GNU, BSD and sun make.


Generic Usage
-------------

[g|bsd]make [-f Makefile.generic] [all|clean|install|...] [INSTALL_TOP=<path>]


Embedded Mode
-------------
Makefile.generic makefiles are taken "as-is" without the need for extra configuration.

<VAR1>=<VALUE1> ... bsdmake -f Makefile.generic
<VAR1>=<VALUE1> ... gmake -f Makefile.generic

(Note that setting an env var as above (<VAR1>=<VALUE1>) before running a command is
shell specific. If your shell doesn't support this, set it according to the shell's
style.)

Example:
  dyncall libraries should compile fine on most platforms:
  
  BSDmake:
  $ bsdmake -f Makefile.generic

  GNUmake:
  $ make -f Makefile.generic

  The tests sometimes require special attention to additional 'usual' libraries
  such as math and dynamic linker run-time libs.
  $ LDFLAGS="-lm -ldl" make -f Makefile.generic


Configure Mode
--------------

Usage:

  cd <build-dir> # build-dir can be arbitrary
  ../<path-to-source>/configure [--prefix=<path>]
  make
  make install [DESTDIR=<path>]

The configure script 'configure' writes 'Makefile' files that 
include 'Makefile.generic' and setup variables such as 
VPATH, {SRC,BLD}{TOP,DIR}.

Two build types are supported: In-source and out-of-Source.

in-source builds:
Makefile's are created in parallel to the Makefile.generic files.

out-of-source builds:
the configure script is executed from a (possible empty) build directory. 
The source directory tree is duplicated into that directory.


Useful Variables
----------------

For libraries:
  CC, CFLAGS, CPPFLAGS
For tests:
  CXX, LDFLAGS

MAKE_CMD - The make tool (including -f flag) to run sub-directories.
SRCTOP   - Source top-level directory (defaults to relative top).
BLDTOP   - Build  top-level directory (defaults to SRCTOP).
SRCDIR   - Source directory (defaults to '.').
BLDDIR   - Build  directory (defaults to SRCDIR).

e.g. Makefile.generic in source-tree:

SRCTOP ?= ../../../ # relative path to source-top
BLDTOP ?= ${SRCTOP} # defaults for in-source builds
SRCDIR ?= .         # relative path to current directory
BLDDIR ?= ${BLDDIR} # relative path to current directory


Include Directories
-------------------
Use -I${SRCTOP}/... to refer to other include directories.


Link Directories
----------------
Use -L${BLDTOP}/... to refer to other build directories.


Plaform Notes:
--------------
Linux: 
- all: ok.
  make -f Makefile.generic all
- tests: need 'm' and 'dl' libs. 
  ( cd tests ; LDFLAGS="-lm -ldl" make -f Makefile.generic )
- see batch script: buildsys/scripts/batch-build-linux.sh

Minix: No dynload support. No '-fPIC' is allowed.
- dynload: unsupport, no dynamic linker present in Minix 3.
- dyn{call,callback}: ok, without '-fPIC'!
  ( cd dyncall ; CFLAGS= make -f Makefile.generic dyncall dyncallback )
- tests: ok
  ( cd test ; make -f Makefile.generic all-dyncall all-dyncallback )
- see batch script: buildsys/scripts/batch-build-minix.sh

NetBSD/FreeBSD:
- all: ok.
  make -f Makefile.generic all
- tests: need math lib:
  ( cd tests ; LDFLAGS="-lm" make -f Makefile.generic )

OpenBSD:
- all: ok.
  make -f Makefile.generic all
- tests: *.cpp implicit rule not set, therefore only c tests work:
  ( cd tests ; LDFLAGS="-lm" make -f Makefile.generic all-c )
- install: ok.

Haiku Alpha 2:
- dynload: elf.h header found, install system source for dynload support
- dyn{call,callback}: ok.
  make -f Makefile.generic dyncall dyncallback
- tests: ok
  ( cd test ; make -f Makefile.generic all-dyncall all-dyncallback )


Build notes related to dyncall:
-------------------------------

CFLAGS
  Use '-fPIC' for at least 64-bit systems and when you want the code to be 
  included as a shared library or module image.
LDFLAGS
  Use '-lm' for test/suite - it uses pow function.
  Use '-ldl' for dynload examples such as test/nm and test/resolve_self on Linux.


Feature:
--------
configure --prefix=<prefix> -> Makefile DESTDIR=variable
make -f Makefile.generic DESTDIR=<prefix>


Todo: 
-----
- sun's make: CXX does not exist.. no rule for *.cpp files but *.cc.