diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-04-16 09:40:09 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-04-16 09:40:09 +0200 |
commit | 2224f05d43a0d782b626d09f397767597b3d7f4f (patch) | |
tree | 48db4a61f2fe98ade733c57af102c912f475473b /makefile-so/Makefile | |
parent | 3c54b36fa04a7c54bb685705397ce3eac707f956 (diff) | |
download | skeletons-2224f05d43a0d782b626d09f397767597b3d7f4f.zip skeletons-2224f05d43a0d782b626d09f397767597b3d7f4f.tar.gz |
add makefile-so
Diffstat (limited to 'makefile-so/Makefile')
-rw-r--r-- | makefile-so/Makefile | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/makefile-so/Makefile b/makefile-so/Makefile new file mode 100644 index 0000000..9a2de9d --- /dev/null +++ b/makefile-so/Makefile @@ -0,0 +1,33 @@ +CC = gcc +CCFLAGS=-pedantic -Wall +LD_OPTS= + +# $< - the current dependcy file +# $@ - the current target file +# $* - the base name of the current target +# $? - all dependencies that are newer than the target +# -fPIV : emit position-independent code +# -nostartfiles : do not use the standard system startup files when linking + +%.o: %.c + $(CC) $(CCFLAGS) -c -I. -o $@ $< + +default: all + +clib.o: clib.c + $(CC) $(CCFLAGS) -c -fPIC $< + +libclib.so: clib.o + $(CC) $(CCFLAGS) -shared -nostartfiles -Wl,-soname,libclib.so -o libclib.so.1.0 $< + +ldlinks: + @ldconfig -n . + +main: libclib.so ldlinks main.o + $(CC) $(LD_OPTS) main.o -L. -lclib -o main + +all: main + +clean: + rm -f main *.o *.so* *~ + |