I am trying to create a makefile that will create a shared library using the my_sin.o, my_cos.o, and my_tan.o files. I was able to create a static version but am having issues with the changes needed for a shared Library.
Currently also getting the following output when I attempt to make. I have verified that everything that should be a tab is.
make: Nothing to be done for 'libmy_math.so'.
Makefile:
CC=gcc
CFLAGS=-fPIC -Wall -g
OBJECTS=my_sin.o my_cos.o my_tan.o
LIBDIR=-L/home/devin/Desktop/CSCV352/Week9/HW_9_5/HW_9_5
libmy_math.so: my_sin.o my_cos.o my_tan.o
test_9_5:$(OBJECTS) main.c libmy_math.so
.c.o:
$(CC) $(CFLAGS) -c $<
clean:
rm -f *~
rm -f *.o
rm -f test_9_5
The file 'libmy_math.so' doesn't exist yet or the makefile can't find it. If you want 'libmy_math.so' to be created by the makefile, there needs to be a rule where libmy_math.so appears on the left of the colon.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.