I have to write simple makefile
program that combines three files: mymath.h
mymath.c
and calc.c
,build static and shared library,link everything and in the end delete all unnecessary files
I have already finished my program,but when I try to run ./libshared
im getting error
all: lib_dyn_run lib_stat_run clean
lib_dyn_run: calc.c lib_dyn.so
gcc calc.c -o libshared -L. lib_dyn.so
lib_dyn.so: mymathdyn.o calcdyn.o
gcc -shared -o lib_dyn.so mymathdyn.o calcdyn.o
mymathdyn.o: mymath.c
gcc -fPIC -c mymath.c -o mymathdyn.o
calcdyn.o: calc.c
gcc -fPIC -c calc.c -o calcdyn.o
lib_stat_run: calc.c lib_stat.a
gcc -o libstatic calc.c -L. lib_stat.a
lib_stat.a: mymath.o calc.o
ar rcs lib_stat.a mymath.o calc.o
mymath.o: mymath.c mymath.h
gcc -c mymath.c
calc.o: calc.c mymath.h
gcc -c calc.c
clean:
rm -f all *.o *.a *.so *.gch
When I run ./libstatic
everything is fine and im getting correct result
When I run ./libshared
im getting error
error while loading shared libraries: ?: cannot open shared object file: No such file or directory
I know that problem is .so in "clean" function but how is that necessary file since it's build similarly to lib_stat_run
that works fine.I want to remove all files except source files and two .exe files