.PHONY: all clean all: example example_static example_dynamic clean: rm -f example *.o lib*.a example: example.o hello.o gcc example.o hello.o -o example example.o: example.c hello.h gcc -Wall -I. -c example.c -o example.o hello.o: hello.c hello.h debug.h gcc -Wall -I. -c hello.c -o hello.o libhello.a: hello.o ar rcs libhello.a hello.o example_static: example.o libhello.a gcc example.o -Wl,-Bstatic -lhello -L. -Wl,-Bdynamic -o example_static hello_fpic.o: hello.c hello.h debug.h gcc -Wall -I. -c -fPIC hello.c -o hello_fpic.o libhello.so: hello_fpic.o gcc -shared hello_fpic.o -o libhello.so example_dynamic: example.o libhello.so gcc example.o -lhello -L. -o example_dynamic