I am writing a make file for .c files
I want to be able to execute it on Linux.
It makes many files, so for simplicity, I've eliminated most of them and placed a few dummy names so you can see the structure of the makefile
The .a file gets made, but at least one problem I have is that the .so file is not made.
Can anyone see the problem?
---------------------------------------------------------
OBJDIR=obj
SRCDIR=src
libMine.a : $(OBJDIR)/myfile1.o $(OBJDIR)/myfile2.o $(OBJDIR)/main.o
ar -rc libMine.a $(OBJDIR)/myfile1.o $(OBJDIR)/myfile2.o $(OBJDIR)/main.o
$(OBJDIR)/myfile1.o : $(SRCDIR)/myfile1.c
g++ -fPIC -o$(OBJDIR)/myfile1.o -c -Iincludes $(SRCDIR)/myfile1.c
$(OBJDIR)/myfile2.o : $(SRCDIR)/myfile2.c
g++ -fPIC -o$(OBJDIR)/myfile2.o -c -Iincludes $(SRCDIR)/myfile2.c
$(OBJDIR)/main.o : $(SRCDIR)/main.c
g++ -fPIC -o$(OBJDIR)/main.o -c -Iincludes $(SRCDIR)/main.c
all : libMine.a
clean :
-rm libMine.a $(OBJDIR)/myfile1.o $(OBJDIR)/myfile2.o $(OBJDIR)/main.o
ld -shared -soname libMine.so.1 -o libMine.so.1.0 -lc $(OBJDIR)/ $(OBJDIR)/myfile1.o $(OBJDIR)/myfile2.o $(OBJDIR)/main.o
ldconfig -v -n .