2
= Use libusual the simplest way =
5
Simplest usage would be to configure and build libusual
6
locally and point your projects CPPFLAGS and LDFLAGS there.
8
That way you get access to not only code but also
9
various autoconfigued symbols without any complexities
15
---------------------------------
16
$ git clone git://github.com/libusual/libusual.git lib
22
$ ./configure --disable-shared --prefix=/opt
26
$ make install DESTDIR=`pwd`/../inst
29
---------------------------------
31
== Build our own code ==
34
Now we prepare our own code.
37
First, this is the source file:
41
-----------------------------------
44
#include <usual/crc32.h>
48
const char *data = "CECSFXX";
51
crc = calc_crc32(data, strlen(data), 0);
52
printf("crc: %08x\n", crc);
55
-----------------------------------
57
Here is corresponding Makefile:
61
-----------------------------------
62
# here we describe our program
66
# here we link to libusual
67
CPPFLAGS = -I./inst/opt/include
68
LDFLAGS = -L./inst/opt/lib
77
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
78
-----------------------------------
82
---------------------------------
84
gcc -O -g -Wall -I./inst/opt/include -c -o prog.o prog.c
85
gcc -O -g -Wall -L./inst/opt/lib prog.o -lusual -o prog
87
Makefile inst lib prog prog.c prog.o
90
---------------------------------