2013-12-25 17:27:41 +01:00
|
|
|
|
|
|
|
|
2014-03-09 17:53:39 +01:00
|
|
|
all: build static-lib dynamic-lib example compile-tests test
|
2013-12-25 17:27:41 +01:00
|
|
|
|
|
|
|
build:
|
2014-02-21 22:51:43 +01:00
|
|
|
gcc -c -g cmdlineoptions.c
|
2013-12-25 17:27:41 +01:00
|
|
|
|
2013-12-26 13:42:05 +01:00
|
|
|
static-lib: build
|
2013-12-25 17:27:41 +01:00
|
|
|
ar cq libcmdlineoptions.a cmdlineoptions.o
|
|
|
|
|
|
|
|
|
2013-12-26 13:42:05 +01:00
|
|
|
dynamic-lib:
|
2014-02-21 22:51:43 +01:00
|
|
|
gcc -c -fPIC -g -o cmdlineoptions-dynamic.o cmdlineoptions.c
|
|
|
|
ld -G cmdlineoptions-dynamic.o -o libcmdlineoptions.so
|
2013-12-26 13:36:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
clean:
|
2014-03-09 17:53:39 +01:00
|
|
|
rm -f *.o *.a *.so example-shared example-static tests-shared tests-static
|
2013-12-27 19:59:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
example:
|
2014-02-21 22:51:43 +01:00
|
|
|
gcc -I. -g example.c -o example-shared -L. -lcmdlineoptions
|
2014-02-22 21:47:27 +01:00
|
|
|
gcc -g example.c -o example-static libcmdlineoptions.a
|
|
|
|
|
|
|
|
|
|
|
|
compile-tests:
|
|
|
|
gcc -I. -g tests.c -o tests-shared -L. -lcmdlineoptions
|
|
|
|
gcc tests.c -o tests-static libcmdlineoptions.a
|
|
|
|
|
|
|
|
test:
|
2014-03-09 17:53:39 +01:00
|
|
|
LD_LIBRARY_PATH="." ./tests-shared
|
|
|
|
./tests-static
|
|
|
|
|
|
|
|
|
|
|
|
install:
|
|
|
|
cp libcmdlineoptions.so /usr/lib/
|
|
|
|
cp libcmdlineoptions.a /usr/lib/
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm /usr/lib/libcmdlineoptions.*
|