ruby-minisat 1.14.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -21
  3. data/Gemfile +4 -0
  4. data/LICENSE +3 -2
  5. data/README.md +42 -0
  6. data/Rakefile +1 -48
  7. data/examples/shikaku.rb +2 -2
  8. data/ext/minisat/extconf.rb +19 -4
  9. data/ext/minisat/minisat-wrap.cpp +11 -5
  10. data/ext/minisat/minisat.c +17 -3
  11. data/ext/minisat/minisat.h +1 -1
  12. data/minisat/minisat-2.2.0.tar.gz +0 -0
  13. data/minisat/{MiniSat_v1.14 → minisat}/LICENSE +2 -1
  14. data/minisat/minisat/README +24 -0
  15. data/minisat/minisat/core/Dimacs.h +89 -0
  16. data/minisat/minisat/core/Main.cc +192 -0
  17. data/minisat/minisat/core/Solver.cc +923 -0
  18. data/minisat/minisat/core/Solver.h +373 -0
  19. data/minisat/minisat/core/SolverTypes.h +407 -0
  20. data/minisat/minisat/mtl/Alg.h +84 -0
  21. data/minisat/minisat/mtl/Alloc.h +131 -0
  22. data/minisat/minisat/mtl/Heap.h +148 -0
  23. data/minisat/minisat/mtl/IntTypes.h +42 -0
  24. data/minisat/minisat/mtl/Map.h +193 -0
  25. data/minisat/minisat/mtl/Queue.h +69 -0
  26. data/minisat/{MiniSat_v1.14 → minisat/mtl}/Sort.h +14 -47
  27. data/minisat/minisat/mtl/Vec.h +130 -0
  28. data/minisat/minisat/mtl/XAlloc.h +45 -0
  29. data/minisat/minisat/mtl/config.mk +6 -0
  30. data/minisat/minisat/mtl/template.mk +107 -0
  31. data/minisat/minisat/simp/Main.cc +211 -0
  32. data/minisat/minisat/simp/SimpSolver.cc +717 -0
  33. data/minisat/minisat/simp/SimpSolver.h +197 -0
  34. data/minisat/minisat/utils/Options.cc +91 -0
  35. data/minisat/minisat/utils/Options.h +386 -0
  36. data/minisat/minisat/utils/ParseUtils.h +122 -0
  37. data/minisat/minisat/utils/System.cc +95 -0
  38. data/minisat/minisat/utils/System.h +60 -0
  39. data/ruby-minisat.gemspec +21 -0
  40. metadata +94 -75
  41. data/README.rdoc +0 -56
  42. data/minisat/MiniSat_v1.14.2006-Aug-29.src.zip +0 -0
  43. data/minisat/MiniSat_v1.14/Global.h +0 -274
  44. data/minisat/MiniSat_v1.14/Heap.h +0 -100
  45. data/minisat/MiniSat_v1.14/Main.C +0 -244
  46. data/minisat/MiniSat_v1.14/Makefile +0 -88
  47. data/minisat/MiniSat_v1.14/README +0 -30
  48. data/minisat/MiniSat_v1.14/Solver.C +0 -781
  49. data/minisat/MiniSat_v1.14/Solver.h +0 -206
  50. data/minisat/MiniSat_v1.14/Solver.o +0 -0
  51. data/minisat/MiniSat_v1.14/SolverTypes.h +0 -130
  52. data/minisat/MiniSat_v1.14/TODO +0 -73
  53. data/minisat/MiniSat_v1.14/VarOrder.h +0 -96
@@ -0,0 +1,69 @@
1
+ /*****************************************************************************************[Queue.h]
2
+ Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson
3
+ Copyright (c) 2007-2010, Niklas Sorensson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6
+ associated documentation files (the "Software"), to deal in the Software without restriction,
7
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
8
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or
12
+ substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
18
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
+ **************************************************************************************************/
20
+
21
+ #ifndef Minisat_Queue_h
22
+ #define Minisat_Queue_h
23
+
24
+ #include "mtl/Vec.h"
25
+
26
+ namespace Minisat {
27
+
28
+ //=================================================================================================
29
+
30
+ template<class T>
31
+ class Queue {
32
+ vec<T> buf;
33
+ int first;
34
+ int end;
35
+
36
+ public:
37
+ typedef T Key;
38
+
39
+ Queue() : buf(1), first(0), end(0) {}
40
+
41
+ void clear (bool dealloc = false) { buf.clear(dealloc); buf.growTo(1); first = end = 0; }
42
+ int size () const { return (end >= first) ? end - first : end - first + buf.size(); }
43
+
44
+ const T& operator [] (int index) const { assert(index >= 0); assert(index < size()); return buf[(first + index) % buf.size()]; }
45
+ T& operator [] (int index) { assert(index >= 0); assert(index < size()); return buf[(first + index) % buf.size()]; }
46
+
47
+ T peek () const { assert(first != end); return buf[first]; }
48
+ void pop () { assert(first != end); first++; if (first == buf.size()) first = 0; }
49
+ void insert(T elem) { // INVARIANT: buf[end] is always unused
50
+ buf[end++] = elem;
51
+ if (end == buf.size()) end = 0;
52
+ if (first == end){ // Resize:
53
+ vec<T> tmp((buf.size()*3 + 1) >> 1);
54
+ //**/printf("queue alloc: %d elems (%.1f MB)\n", tmp.size(), tmp.size() * sizeof(T) / 1000000.0);
55
+ int i = 0;
56
+ for (int j = first; j < buf.size(); j++) tmp[i++] = buf[j];
57
+ for (int j = 0 ; j < end ; j++) tmp[i++] = buf[j];
58
+ first = 0;
59
+ end = buf.size();
60
+ tmp.moveTo(buf);
61
+ }
62
+ }
63
+ };
64
+
65
+
66
+ //=================================================================================================
67
+ }
68
+
69
+ #endif
@@ -1,5 +1,6 @@
1
1
  /******************************************************************************************[Sort.h]
2
- MiniSat -- Copyright (c) 2003-2005, Niklas Een, Niklas Sorensson
2
+ Copyright (c) 2003-2007, Niklas Een, Niklas Sorensson
3
+ Copyright (c) 2007-2010, Niklas Sorensson
3
4
 
4
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5
6
  associated documentation files (the "Software"), to deal in the Software without restriction,
@@ -17,22 +18,23 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
17
18
  OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
19
  **************************************************************************************************/
19
20
 
20
- #ifndef Sort_h
21
- #define Sort_h
21
+ #ifndef Minisat_Sort_h
22
+ #define Minisat_Sort_h
22
23
 
24
+ #include "mtl/Vec.h"
23
25
 
24
26
  //=================================================================================================
27
+ // Some sorting algorithms for vec's
25
28
 
26
29
 
30
+ namespace Minisat {
31
+
27
32
  template<class T>
28
33
  struct LessThan_default {
29
34
  bool operator () (T x, T y) { return x < y; }
30
35
  };
31
36
 
32
37
 
33
- //=================================================================================================
34
-
35
-
36
38
  template <class T, class LessThan>
37
39
  void selectionSort(T* array, int size, LessThan lt)
38
40
  {
@@ -51,15 +53,14 @@ void selectionSort(T* array, int size, LessThan lt)
51
53
  template <class T> static inline void selectionSort(T* array, int size) {
52
54
  selectionSort(array, size, LessThan_default<T>()); }
53
55
 
54
-
55
56
  template <class T, class LessThan>
56
- void sort(T* array, int size, LessThan lt, double& seed)
57
+ void sort(T* array, int size, LessThan lt)
57
58
  {
58
59
  if (size <= 15)
59
60
  selectionSort(array, size, lt);
60
61
 
61
62
  else{
62
- T pivot = array[irand(seed, size)];
63
+ T pivot = array[size / 2];
63
64
  T tmp;
64
65
  int i = -1;
65
66
  int j = size;
@@ -73,40 +74,14 @@ void sort(T* array, int size, LessThan lt, double& seed)
73
74
  tmp = array[i]; array[i] = array[j]; array[j] = tmp;
74
75
  }
75
76
 
76
- sort(array , i , lt, seed);
77
- sort(&array[i], size-i, lt, seed);
77
+ sort(array , i , lt);
78
+ sort(&array[i], size-i, lt);
78
79
  }
79
80
  }
80
- template <class T, class LessThan> void sort(T* array, int size, LessThan lt) {
81
- double seed = 91648253; sort(array, size, lt, seed); }
82
81
  template <class T> static inline void sort(T* array, int size) {
83
82
  sort(array, size, LessThan_default<T>()); }
84
83
 
85
84
 
86
- template <class T, class LessThan>
87
- void sortUnique(T* array, int& size, LessThan lt)
88
- {
89
- int i, j;
90
- T last;
91
-
92
- if (size == 0) return;
93
-
94
- sort(array, size, lt);
95
-
96
- i = 1;
97
- last = array[0];
98
- for (j = 1; j < size; j++){
99
- if (lt(last, array[j])){
100
- last = array[i] = array[j];
101
- i++; }
102
- }
103
-
104
- size = i;
105
- }
106
- template <class T> static inline void sortUnique(T* array, int& size) {
107
- sortUnique(array, size, LessThan_default<T>()); }
108
-
109
-
110
85
  //=================================================================================================
111
86
  // For 'vec's:
112
87
 
@@ -117,15 +92,7 @@ template <class T> void sort(vec<T>& v) {
117
92
  sort(v, LessThan_default<T>()); }
118
93
 
119
94
 
120
- template <class T, class LessThan> void sortUnique(vec<T>& v, LessThan lt) {
121
- int size = v.size();
122
- T* data = v.release();
123
- sortUnique(data, size, lt);
124
- v.~vec<T>();
125
- new (&v) vec<T>(data, size); }
126
- template <class T> void sortUnique(vec<T>& v) {
127
- sortUnique(v, LessThan_default<T>()); }
128
-
129
-
130
95
  //=================================================================================================
96
+ }
97
+
131
98
  #endif
@@ -0,0 +1,130 @@
1
+ /*******************************************************************************************[Vec.h]
2
+ Copyright (c) 2003-2007, Niklas Een, Niklas Sorensson
3
+ Copyright (c) 2007-2010, Niklas Sorensson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6
+ associated documentation files (the "Software"), to deal in the Software without restriction,
7
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
8
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or
12
+ substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
18
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
+ **************************************************************************************************/
20
+
21
+ #ifndef Minisat_Vec_h
22
+ #define Minisat_Vec_h
23
+
24
+ #include <assert.h>
25
+ #include <new>
26
+
27
+ #include "mtl/IntTypes.h"
28
+ #include "mtl/XAlloc.h"
29
+
30
+ namespace Minisat {
31
+
32
+ //=================================================================================================
33
+ // Automatically resizable arrays
34
+ //
35
+ // NOTE! Don't use this vector on datatypes that cannot be re-located in memory (with realloc)
36
+
37
+ template<class T>
38
+ class vec {
39
+ T* data;
40
+ int sz;
41
+ int cap;
42
+
43
+ // Don't allow copying (error prone):
44
+ vec<T>& operator = (vec<T>& other) { assert(0); return *this; }
45
+ vec (vec<T>& other) { assert(0); }
46
+
47
+ // Helpers for calculating next capacity:
48
+ static inline int imax (int x, int y) { int mask = (y-x) >> (sizeof(int)*8-1); return (x&mask) + (y&(~mask)); }
49
+ //static inline void nextCap(int& cap){ cap += ((cap >> 1) + 2) & ~1; }
50
+ static inline void nextCap(int& cap){ cap += ((cap >> 1) + 2) & ~1; }
51
+
52
+ public:
53
+ // Constructors:
54
+ vec() : data(NULL) , sz(0) , cap(0) { }
55
+ explicit vec(int size) : data(NULL) , sz(0) , cap(0) { growTo(size); }
56
+ vec(int size, const T& pad) : data(NULL) , sz(0) , cap(0) { growTo(size, pad); }
57
+ ~vec() { clear(true); }
58
+
59
+ // Pointer to first element:
60
+ operator T* (void) { return data; }
61
+
62
+ // Size operations:
63
+ int size (void) const { return sz; }
64
+ void shrink (int nelems) { assert(nelems <= sz); for (int i = 0; i < nelems; i++) sz--, data[sz].~T(); }
65
+ void shrink_ (int nelems) { assert(nelems <= sz); sz -= nelems; }
66
+ int capacity (void) const { return cap; }
67
+ void capacity (int min_cap);
68
+ void growTo (int size);
69
+ void growTo (int size, const T& pad);
70
+ void clear (bool dealloc = false);
71
+
72
+ // Stack interface:
73
+ void push (void) { if (sz == cap) capacity(sz+1); new (&data[sz]) T(); sz++; }
74
+ void push (const T& elem) { if (sz == cap) capacity(sz+1); data[sz++] = elem; }
75
+ void push_ (const T& elem) { assert(sz < cap); data[sz++] = elem; }
76
+ void pop (void) { assert(sz > 0); sz--, data[sz].~T(); }
77
+ // NOTE: it seems possible that overflow can happen in the 'sz+1' expression of 'push()', but
78
+ // in fact it can not since it requires that 'cap' is equal to INT_MAX. This in turn can not
79
+ // happen given the way capacities are calculated (below). Essentially, all capacities are
80
+ // even, but INT_MAX is odd.
81
+
82
+ const T& last (void) const { return data[sz-1]; }
83
+ T& last (void) { return data[sz-1]; }
84
+
85
+ // Vector interface:
86
+ const T& operator [] (int index) const { return data[index]; }
87
+ T& operator [] (int index) { return data[index]; }
88
+
89
+ // Duplicatation (preferred instead):
90
+ void copyTo(vec<T>& copy) const { copy.clear(); copy.growTo(sz); for (int i = 0; i < sz; i++) copy[i] = data[i]; }
91
+ void moveTo(vec<T>& dest) { dest.clear(true); dest.data = data; dest.sz = sz; dest.cap = cap; data = NULL; sz = 0; cap = 0; }
92
+ };
93
+
94
+
95
+ template<class T>
96
+ void vec<T>::capacity(int min_cap) {
97
+ if (cap >= min_cap) return;
98
+ int add = imax((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2
99
+ if (add > INT_MAX - cap || ((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM)
100
+ throw OutOfMemoryException();
101
+ }
102
+
103
+
104
+ template<class T>
105
+ void vec<T>::growTo(int size, const T& pad) {
106
+ if (sz >= size) return;
107
+ capacity(size);
108
+ for (int i = sz; i < size; i++) data[i] = pad;
109
+ sz = size; }
110
+
111
+
112
+ template<class T>
113
+ void vec<T>::growTo(int size) {
114
+ if (sz >= size) return;
115
+ capacity(size);
116
+ for (int i = sz; i < size; i++) new (&data[i]) T();
117
+ sz = size; }
118
+
119
+
120
+ template<class T>
121
+ void vec<T>::clear(bool dealloc) {
122
+ if (data != NULL){
123
+ for (int i = 0; i < sz; i++) data[i].~T();
124
+ sz = 0;
125
+ if (dealloc) free(data), data = NULL, cap = 0; } }
126
+
127
+ //=================================================================================================
128
+ }
129
+
130
+ #endif
@@ -0,0 +1,45 @@
1
+ /****************************************************************************************[XAlloc.h]
2
+ Copyright (c) 2009-2010, Niklas Sorensson
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5
+ associated documentation files (the "Software"), to deal in the Software without restriction,
6
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
7
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or
11
+ substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
14
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
17
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
+ **************************************************************************************************/
19
+
20
+
21
+ #ifndef Minisat_XAlloc_h
22
+ #define Minisat_XAlloc_h
23
+
24
+ #include <errno.h>
25
+ #include <stdlib.h>
26
+
27
+ namespace Minisat {
28
+
29
+ //=================================================================================================
30
+ // Simple layer on top of malloc/realloc to catch out-of-memory situtaions and provide some typing:
31
+
32
+ class OutOfMemoryException{};
33
+ static inline void* xrealloc(void *ptr, size_t size)
34
+ {
35
+ void* mem = realloc(ptr, size);
36
+ if (mem == NULL && errno == ENOMEM){
37
+ throw OutOfMemoryException();
38
+ }else
39
+ return mem;
40
+ }
41
+
42
+ //=================================================================================================
43
+ }
44
+
45
+ #endif
@@ -0,0 +1,6 @@
1
+ ##
2
+ ## This file is for system specific configurations. For instance, on
3
+ ## some systems the path to zlib needs to be added. Example:
4
+ ##
5
+ ## CFLAGS += -I/usr/local/include
6
+ ## LFLAGS += -L/usr/local/lib
@@ -0,0 +1,107 @@
1
+ ##
2
+ ## Template makefile for Standard, Profile, Debug, Release, and Release-static versions
3
+ ##
4
+ ## eg: "make rs" for a statically linked release version.
5
+ ## "make d" for a debug version (no optimizations).
6
+ ## "make" for the standard version (optimized, but with debug information and assertions active)
7
+
8
+ PWD = $(shell pwd)
9
+ EXEC ?= $(notdir $(PWD))
10
+
11
+ CSRCS = $(wildcard $(PWD)/*.cc)
12
+ DSRCS = $(foreach dir, $(DEPDIR), $(filter-out $(MROOT)/$(dir)/Main.cc, $(wildcard $(MROOT)/$(dir)/*.cc)))
13
+ CHDRS = $(wildcard $(PWD)/*.h)
14
+ COBJS = $(CSRCS:.cc=.o) $(DSRCS:.cc=.o)
15
+
16
+ PCOBJS = $(addsuffix p, $(COBJS))
17
+ DCOBJS = $(addsuffix d, $(COBJS))
18
+ RCOBJS = $(addsuffix r, $(COBJS))
19
+
20
+
21
+ CXX ?= g++
22
+ CFLAGS ?= -Wall -Wno-parentheses
23
+ LFLAGS ?= -Wall
24
+
25
+ COPTIMIZE ?= -O3
26
+
27
+ CFLAGS += -I$(MROOT) -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS
28
+ LFLAGS += -lz
29
+
30
+ .PHONY : s p d r rs clean
31
+
32
+ s: $(EXEC)
33
+ p: $(EXEC)_profile
34
+ d: $(EXEC)_debug
35
+ r: $(EXEC)_release
36
+ rs: $(EXEC)_static
37
+
38
+ libs: lib$(LIB)_standard.a
39
+ libp: lib$(LIB)_profile.a
40
+ libd: lib$(LIB)_debug.a
41
+ libr: lib$(LIB)_release.a
42
+
43
+ ## Compile options
44
+ %.o: CFLAGS +=$(COPTIMIZE) -g -D DEBUG
45
+ %.op: CFLAGS +=$(COPTIMIZE) -pg -g -D NDEBUG
46
+ %.od: CFLAGS +=-O0 -g -D DEBUG
47
+ %.or: CFLAGS +=$(COPTIMIZE) -g -D NDEBUG
48
+
49
+ ## Link options
50
+ $(EXEC): LFLAGS += -g
51
+ $(EXEC)_profile: LFLAGS += -g -pg
52
+ $(EXEC)_debug: LFLAGS += -g
53
+ #$(EXEC)_release: LFLAGS += ...
54
+ $(EXEC)_static: LFLAGS += --static
55
+
56
+ ## Dependencies
57
+ $(EXEC): $(COBJS)
58
+ $(EXEC)_profile: $(PCOBJS)
59
+ $(EXEC)_debug: $(DCOBJS)
60
+ $(EXEC)_release: $(RCOBJS)
61
+ $(EXEC)_static: $(RCOBJS)
62
+
63
+ lib$(LIB)_standard.a: $(filter-out */Main.o, $(COBJS))
64
+ lib$(LIB)_profile.a: $(filter-out */Main.op, $(PCOBJS))
65
+ lib$(LIB)_debug.a: $(filter-out */Main.od, $(DCOBJS))
66
+ lib$(LIB)_release.a: $(filter-out */Main.or, $(RCOBJS))
67
+
68
+
69
+ ## Build rule
70
+ %.o %.op %.od %.or: %.cc
71
+ @echo Compiling: $(subst $(MROOT)/,,$@)
72
+ @$(CXX) $(CFLAGS) -c -o $@ $<
73
+
74
+ ## Linking rules (standard/profile/debug/release)
75
+ $(EXEC) $(EXEC)_profile $(EXEC)_debug $(EXEC)_release $(EXEC)_static:
76
+ @echo Linking: "$@ ( $(foreach f,$^,$(subst $(MROOT)/,,$f)) )"
77
+ @$(CXX) $^ $(LFLAGS) -o $@
78
+
79
+ ## Library rules (standard/profile/debug/release)
80
+ lib$(LIB)_standard.a lib$(LIB)_profile.a lib$(LIB)_release.a lib$(LIB)_debug.a:
81
+ @echo Making library: "$@ ( $(foreach f,$^,$(subst $(MROOT)/,,$f)) )"
82
+ @$(AR) -rcsv $@ $^
83
+
84
+ ## Library Soft Link rule:
85
+ libs libp libd libr:
86
+ @echo "Making Soft Link: $^ -> lib$(LIB).a"
87
+ @ln -sf $^ lib$(LIB).a
88
+
89
+ ## Clean rule
90
+ clean:
91
+ @rm -f $(EXEC) $(EXEC)_profile $(EXEC)_debug $(EXEC)_release $(EXEC)_static \
92
+ $(COBJS) $(PCOBJS) $(DCOBJS) $(RCOBJS) *.core depend.mk
93
+
94
+ ## Make dependencies
95
+ depend.mk: $(CSRCS) $(CHDRS)
96
+ @echo Making dependencies
97
+ @$(CXX) $(CFLAGS) -I$(MROOT) \
98
+ $(CSRCS) -MM | sed 's|\(.*\):|$(PWD)/\1 $(PWD)/\1r $(PWD)/\1d $(PWD)/\1p:|' > depend.mk
99
+ @for dir in $(DEPDIR); do \
100
+ if [ -r $(MROOT)/$${dir}/depend.mk ]; then \
101
+ echo Depends on: $${dir}; \
102
+ cat $(MROOT)/$${dir}/depend.mk >> depend.mk; \
103
+ fi; \
104
+ done
105
+
106
+ -include $(MROOT)/mtl/config.mk
107
+ -include depend.mk