kinda chaotic i know, but i made it for myself :P
under binsem.a
"gcc -c binsem.c" creates the binsem.o
binsem.o is then inserted by ar into libbinsem.a
then ranlib does some indexing (not a must afaik)
libbinsem.a is then used by the first gcc command where you see -lbinsem.
if
you want to use a static lib that doesnt have the lib prefix -lbinsem
can be replaces with binsem.a for example if you want to call it
binsem.a
like so:
ph: ph.c binsem.a
gcc ${FLAGS} ph.c binsem.a -lut -o ph
gcc ${FLAGS} ph.c binsem.a -lut -o ph
binsem.a:
gcc $(FLAGS) -c binsem.c
ar rcu binsem.a binsem.o
ranlib binsem.a
here is the makefile itself:
gcc $(FLAGS) -c binsem.c
ar rcu binsem.a binsem.o
ranlib binsem.a
here is the makefile itself:
#all: binsem.a ut.a ph
FLAGS = -Wall -Werror -L./
ph: ph.c binsem.a
gcc ${FLAGS} ph.c -lbinsem -lut -o ph
binsem.a:
gcc $(FLAGS) -c binsem.c
ar rcu libbinsem.a binsem.o
ranlib libbinsem.a
ut.a:
gcc $(FLAGS) -c ut.c
ar rcu libut.a ut.o
ranlib libut.a
clean:
rm -f *.o
rm -f a.out
rm -f *~
rm -f ph
rm -f *a