3 # This is a make+ file. Make+ is a set of scripts which enhance GNU
4 # make and let you build RPMs, and other package types with just one
5 # control file. To build this package you will need to download make+
6 # from this site: http://www.annexia.org/freeware/makeplus/
11 VERSION := $(VERSION_MAJOR).$(VERSION_MINOR)
13 SUMMARY := A library of useful functions for C.
14 COPYRIGHT := GNU LGPL (see http://www.gnu.org/)
15 AUTHOR := Richard Jones <rich@annexia.org>
18 c2lib is a library of useful functions which augment those found in
19 the standard libc. It contains a pool allocator, many string
20 functions, STL-like vector and hash types and miscellaneous utilities.
23 RPM_REQUIRES := pcre >= 3.9
24 RPM_GROUP := Development/Libraries
26 CFLAGS += -Wall -Werror -g -O2 -D_GNU_SOURCE
27 ifneq ($(shell uname), SunOS)
28 # Avoid a warning about reordering system include paths.
29 CFLAGS += $(shell pcre-config --cflags)
31 LIBS += $(shell pcre-config --libs) -lm
33 OBJS := hash.o matvec.o pool.o pre.o pstring.o tree.o vector.o
34 LOBJS := $(OBJS:.o=.lo)
35 HEADERS := $(srcdir)/hash.h $(srcdir)/matvec.h \
36 $(srcdir)/pool.h $(srcdir)/pre.h $(srcdir)/pstring.h \
37 $(srcdir)/tree.h $(srcdir)/vector.h
39 all: static dynamic manpages syms
41 # Configure the system.
45 $(MP_REQUIRE_PROG) pcre-config
46 $(MP_CHECK_HEADERS) alloca.h assert.h ctype.h fcntl.h string.h unistd.h
47 $(MP_CHECK_FUNCS) vasprintf
50 # Build the static library.
55 $(MP_LINK_STATIC) $@ $^
57 # Build the dynamic library.
62 $(MP_LINK_DYNAMIC) $@ $^ $(LIBS)
64 # Build the manual pages.
66 manpages: $(srcdir)/*.h
70 --author '$(AUTHOR)' \
71 --license '$(COPYRIGHT)' \
72 --version '$(PACKAGE)-$(VERSION)' \
76 # Build the symbols table.
80 libc2lib.syms: libc2lib.so
81 nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@
85 test: test_hash test_matvec test_pool test_pre test_pstring test_sash \
86 test_shash test_tree test_vector
87 LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(MP_RUN_TESTS) $^
89 test_hash: test_hash.o
90 $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS)
91 test_matvec: test_matvec.o
92 $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS)
93 test_pool: test_pool.o
94 $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
96 $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS)
97 test_pstring: test_pstring.o
98 $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS)
99 test_sash: test_sash.o
100 $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS)
101 test_shash: test_shash.o
102 $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS)
103 test_tree: test_tree.o
104 $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS)
105 test_vector: test_vector.o
106 $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS)
111 install -d $(DESTDIR)$(libdir)
112 install -d $(DESTDIR)$(pkgincludedir)
113 install -d $(DESTDIR)$(man3dir)
114 install -d $(DESTDIR)$(datadir)/rws/symtabs/
116 $(MP_INSTALL_STATIC_LIB) libc2lib.a
117 $(MP_INSTALL_DYNAMIC_LIB) libc2lib.so
118 install -m 0644 $(HEADERS) $(DESTDIR)$(pkgincludedir)
119 install -m 0644 *.3 $(DESTDIR)$(man3dir)
120 install -m 0644 *.syms $(DESTDIR)$(datadir)/rws/symtabs/
125 <% include page_header.msp %>
127 <h1>c2lib - a Perl/STL-like library of basics for C</h1>
130 c2lib is a library of basic tools for use by C
131 programmers. It contains features heavily influenced
132 by both Perl's string handling and C++'s Standard
133 Template Library (STL). The library has been designed
134 to be very easy to use and is fully documented in
139 <a href="doc/">There is extensive documentation and
152 <td> <a href="$(PACKAGE)-$(VERSION).tar.gz">$(PACKAGE)-$(VERSION).tar.gz</a> </td>
154 <td> Latest source distribution </td>
157 <td> <a href="$(PACKAGE)-$(VERSION)-1.i686.rpm">$(PACKAGE)-$(VERSION)-1.i686.rpm</a> </td>
158 <td> i686 binary RPM </td>
159 <td> Binary development libraries, header files, man pages
160 for Red Hat Linux </td>
163 <td> <a href="$(PACKAGE)-$(VERSION)-1.src.rpm">$(PACKAGE)-$(VERSION)-1.src.rpm</a> </td>
164 <td> source RPM </td>
165 <td> Source files for Red Hat Linux </td>
174 <li> You will need to install the <a href="http://www.pcre.org/">Perl
175 Compatible Regular Expressions (PCRE)</a> library.
176 <li> Since 1.3.0, c2lib requires the <a href="../makeplus/">make+</a>
178 <li> To rebuild the manual pages which come with the
179 package, you will also need to download
180 <a href="../cdoc/">cdoc</a>.
184 <a href="/cgi-bin/autopatch.pl?dir=c2lib">Patches between versions
191 <b>Sat Mar 1 2003:</b>
192 Created README and INSTALL files (thanks to David Chappell). Updated
193 <code>Makefile+</code> to work with the new version of make+.
194 <strong>NB: The RPMs were built on Debian and may not work on Red Hat
198 <b>Sat Feb 8 17:00:47 GMT 2003:</b>
199 Ported to Solaris, OpenBSD and FreeBSD (thanks to
200 <a href="http://www.azazel.net/">Jeremy Sowden</a>
201 and <a href="http://www.mondaymorning.org/">Richard Baker</a>
202 for help and equipment). Don't link c2lib itself into the
203 <code>test_pool</code> program. Link test programs correctly
204 with <code>pcre</code>.
208 <strong>Attn:</strong> Solaris
209 has a library called <code>libc2</code>. I have had to rename this
210 library to <code>libc2lib</code>, so you will need to link your
211 programs against <code>-lc2lib</code>. I have also moved the
212 header files into the <code>c2lib/<code> subdirectory of
213 includedir, so you may need to specify <code>-I/usr/include/c2lib</code>
218 <b>Sat Dec 7 17:18:02 GMT 2002:</b> Updated to use the
219 <a href="../makeplus/">make+</a> build system.
223 <b>Mon Nov 25 09:31:37 GMT 2002:</b> Added symbols file for full
224 symbol resolution in monolith.
228 <b>Sun Nov 17 23:31:32 GMT 2002:</b> Debian packages. Added MSP files.
229 <code>pmalloc</code> now initialises memory to <code>0xefefefef</code>
230 so we can catch uninitialised memory problems. Further fixes
231 to compile on RH 7.3. Added <code>vector_push_back_vector</code> etc.
235 <b>Tue Oct 15 23:40:42 BST 2002:</b> Multiple bug fixes.
239 <b>Sun Oct 13 12:55:08 BST 2002:</b> Added <code>pmap</code>
240 and <code>pgrep</code> functions.
244 <b>Tue Oct 8 16:18:02 BST 2002:</b> Fix issues with building on
245 Red Hat Linux 7.3 (thanks to Adam Monsen). The supplied
246 RPM should now install on Red Hat Linux systems.
250 <b>Sun Oct 6 18:07:39 BST 2002:</b> Completely rewrote
251 the <code>pstr*split</code> functions so they produce the
252 same results as the Perl equivalents in all the corner
253 cases. Added <code>pstr*split2</code> functions (see
258 <b>Sun Oct 6 13:00:39 BST 2002:</b> Added a <code>tree</code>
259 type (required by monolith). Removed the old <code>pmatch*</code> and
260 <code>psubst*</code> functions. These were badly thought
261 out and implemented. Replaced with <code>precomp</code>,
262 <code>prematch</code>, <code>presubst</code> functions
263 which are wrappers around the <a href="http://www.pcre.org/">Perl
264 Compatible Regular Expressions (PCRE)</a> library.
265 <code>pstrresplit</code> has also changed to use PCRE.
269 <b>Sat Sep 7 15:24:32 BST 2002:</b> Packages are
270 now available as i686 binary RPMs and source RPMs.
273 <h1>Old news and old versions</h1>
276 <b>Fri May 2 19:49:25 BST 2002</b>
280 <a href="c2lib-1.2.14.tar.gz">c2lib-1.2.14.tar.gz</a> released.
281 Added an extensive tutorial and online manual pages.
285 <b>Thu Jun 21 23:12:26 BST 2001</b>
289 <a href="c2lib-1.2.12.tar.gz">c2lib-1.2.12.tar.gz</a> released.
290 Fixed <code>psort</code> function and updated documentation.
294 <b>Fri Jun 15 15:40:35 BST 2001</b>
298 <a href="c2lib-1.2.11.tar.gz">c2lib-1.2.11.tar.gz</a> released.
299 Profiling support. Added <code>pstrncat</code>,
300 <code>psubst</code> and <code>psubstx</code> functions.
301 Fixed a memory leak and did rigorous memory leak
302 checking -- I\'m pretty sure there are none left now.
303 Removed arbitrary limit on number of substring
304 matches in <code>pmatch</code> function.
305 Documentation updates.
309 <b>Mon Apr 9 17:18:38 BST 2001</b>
313 <a href="c2lib-1.2.8.tar.gz">c2lib-1.2.8.tar.gz</a> released.
318 <b>Wed Mar 28 14:25:42 BST 2001</b>
322 <a href="c2lib-1.2.7.tar.gz">c2lib-1.2.7.tar.gz</a> released.
323 Fixed a problem with calling <code>isspace</code> on
324 Solaris (thanks to Tomonori Manome again).
328 <b>Mon Mar 26 12:59:15 BST 2001</b>
332 <a href="c2lib-1.2.6.tar.gz">c2lib-1.2.6.tar.gz</a> released.
333 <code>pstrresplit</code> fixed.
334 <code>pvector</code> and <code>pvectora</code> functions
335 added: use these to quickly build vectors from lists of strings.
336 <code>ptrimfront</code>, <code>ptrimback</code> and <code>ptrim</code>
337 functions added for trimming whitespace from strings.
338 <code>pgetline*</code> and <code>pmatch*</code> functions
339 added which make it trivial to read in configuration files.
340 <code>new_subvector</code> added for creating sub-vectors
342 Some minor const-correctness changes.
343 Documentation updates.
348 <b>Mon Mar 19 11:40:34 GMT 2001</b>
352 <a href="c2lib-1.2.3.tar.gz">c2lib-1.2.3.tar.gz</a> released.
353 This adds the <i>shash</i> type: a mapping of strings
354 to anything (another specialized hash).
355 Port to Solaris/Intel and Solaris/Sparc (thanks to
356 Tomonori Manome for this).
360 <b>Mon Mar 12 12:12:49 GMT 2001</b>
364 <a href="c2lib-1.2.1.tar.gz">c2lib-1.2.1.tar.gz</a> released.
365 This fixes a bug in the way the library was calling
366 <code>pstrcat</code>. Upgrading is highly recommended.
370 <b>Fri Mar 9 17:26:45 GMT 2001</b>
374 <a href="c2lib-1.2.0.tar.gz">c2lib-1.2.0.tar.gz</a> released.
375 The pool allocator has been completely rewritten for this
376 release, and is much more efficient.
380 <b>Wed Mar 7 14:56:43 GMT 2001</b>
384 <a href="c2lib-1.1.12.tar.gz">c2lib-1.1.12.tar.gz</a> released.
385 Added <code>pchrs</code> and <code>pstrs</code> string
386 functions. Added <code>pvsprintf</code>. Changed
387 <code>psprintf</code> to make it much more memory efficient
388 (it uses <code>vasprintf(3)</code> if available).
389 Const-correctness fixes.
393 <b>Fri Feb 16 17:46:41 GMT 2001</b>
397 <a href="c2lib-1.1.10.tar.gz">c2lib-1.1.10.tar.gz</a> released.
398 All functions are documented in manual pages.
401 <% include page_footer.msp %>
405 scp $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)-1.*.rpm \
406 $(PACKAGE)-$(VERSION).bin.tar.gz \
407 10.0.0.248:annexia.org/freeware/$(PACKAGE)/
409 10.0.0.248:annexia.org/freeware/$(PACKAGE)/index.msp
411 .PHONY: static dynamic manpages syms