I have 4 files: 1.c, 1.h, 2.c, 2.h. I need a makefile, which will create a dynamic library (.so) from tho
I'm no gnu make expert, this seems reasonable to me
CFLAGS+=-fPIC %.so: ; $(LINK.c) $(LDFLAGS) -shared $^ -o $@ library.so: 1.o 2.o # default target first # changes to `1.h` imply `1.o` needs to be rebuilt 1.o: 1.h 2.o: 2.h