jengelh-datetimespielwiese
Last change
on this file since b7d64b was
ee668e,
checked in by Jan Engelhardt <jengelh@…>, 11 years ago
|
factory/build: restore out-of-tree build support
When attempting an OOT build, it fails to find <factory/cplusplus.h>,
because cplusplus.h is always (even in in-tree builds) produced in
"${builddir}", and not "${top_srcdir}/../factory".
Furthermore, one must not rely on the basename of ${top_srcdir}, and
going above ${top_srcdir} is undefined and may lead to spurious build
failures. (Consider a hypothetical chroot on ${top_srcdir}).
Therefore, create a directory include/factory and use -Iinclude such
that <factory/*> yields a buildable state, move all exported header
files there.
Previous OOT build log:
17:22 seven:../factory/obj > make
CXX cplusplus.o
CXXLD cplusplus
./cplusplus > ./cplusplus.h
../bin/makeheader ../factory.template factory.h
../bin/makeheader ../factoryconf.template factoryconf.h
YACC readcf.cc
make all-am
make[1]: Entering directory `/home/jengelh/obs/zu/home/jengelh/science/singsource/factory/obj'
CXX libfactory_a-algext.o
CXX libfactory_a-canonicalform.o
In file included from ../cf_factory.h:12:0,
from ../canonicalform.cc:7:
../../factory/cf_gmp.h:14:33: fatal error: factory/cplusplus.h: Ingen slik fil eller filkatalog
compilation terminated.
make[1]: *** [libfactory_a-canonicalform.o] Error 1
make[1]: Leaving directory `/home/jengelh/obs/zu/home/jengelh/science/singsource/factory/obj'
make: *** [all] Error 2
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | /* $Id$ */ |
---|
3 | |
---|
4 | #ifndef INCL_FACTOR_H |
---|
5 | #define INCL_FACTOR_H |
---|
6 | |
---|
7 | // #include <factory/factoryconf.h> |
---|
8 | |
---|
9 | #ifndef NOSTREAMIO |
---|
10 | #ifdef HAVE_IOSTREAM |
---|
11 | #include <iostream> |
---|
12 | #define OSTREAM std::ostream |
---|
13 | #elif defined(HAVE_IOSTREAM_H) |
---|
14 | #include <iostream.h> |
---|
15 | #define OSTREAM ostream |
---|
16 | #endif |
---|
17 | #endif /* NOSTREAMIO */ |
---|
18 | |
---|
19 | |
---|
20 | template <class T> |
---|
21 | class Factor { |
---|
22 | private: |
---|
23 | T _factor; |
---|
24 | int _exp; |
---|
25 | public: |
---|
26 | Factor() : _factor(1), _exp(0) {} |
---|
27 | Factor( const Factor<T> & f ) : _factor(f._factor), _exp(f._exp) {} |
---|
28 | Factor( const T & f, int e ) : _factor(f), _exp(e) {} |
---|
29 | Factor( const T & f ) : _factor(f), _exp(1) {} |
---|
30 | ~Factor() {} |
---|
31 | Factor<T>& operator= ( const Factor<T>& ); |
---|
32 | Factor<T>& operator= ( const T& ); |
---|
33 | T factor() const { return _factor; } |
---|
34 | int exp() const { return _exp; } |
---|
35 | T value() const { return power( _factor, _exp ); } |
---|
36 | Factor<T>& operator+= ( int i ) { _exp += i; return *this; } |
---|
37 | Factor<T>& operator*= ( int i ) { _exp *= i; return *this; } |
---|
38 | Factor<T>& operator*= ( const T & f ) { _factor *= f; return *this; } |
---|
39 | #ifndef NOSTREAMIO |
---|
40 | void print ( OSTREAM& ) const; |
---|
41 | #endif /* NOSTREAMIO */ |
---|
42 | }; |
---|
43 | |
---|
44 | template <class T> int |
---|
45 | operator== ( const Factor<T>&, const Factor<T>& ); |
---|
46 | |
---|
47 | #ifndef NOSTREAMIO |
---|
48 | template <class T> |
---|
49 | OSTREAM& operator<< ( OSTREAM & os, const Factor<T> & f ); |
---|
50 | #endif /* NOSTREAMIO */ |
---|
51 | |
---|
52 | #endif /* ! INCL_FACTOR_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.