2013-12-25 16:27:41 +00:00
|
|
|
|
|
|
|
|
2013-12-27 18:59:33 +00:00
|
|
|
all: build static-lib dynamic-lib example
|
2013-12-25 16:27:41 +00:00
|
|
|
|
|
|
|
build:
|
2014-02-21 21:51:43 +00:00
|
|
|
gcc -c -g cmdlineoptions.c
|
2013-12-25 16:27:41 +00:00
|
|
|
|
2013-12-26 12:42:05 +00:00
|
|
|
static-lib: build
|
2013-12-25 16:27:41 +00:00
|
|
|
ar cq libcmdlineoptions.a cmdlineoptions.o
|
|
|
|
|
|
|
|
|
2013-12-26 12:42:05 +00:00
|
|
|
dynamic-lib:
|
2014-02-21 21:51:43 +00: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:
|
2013-12-27 18:59:33 +00:00
|
|
|
rm -f *.o *.a *.so example
|
|
|
|
|
|
|
|
|
|
|
|
example:
|
2014-02-21 21:51:43 +00:00
|
|
|
gcc -I. -g example.c -o example-shared -L. -lcmdlineoptions
|
|
|
|
gcc -g example.c -o example-static libcmdlineoptions.a
|