I'm trying to compile some c codes with library. And I need to create library to different path before use it. My makefile is like:
CFLAGS = -O3all: libexm.a derle OBJS = b.o c.o d.o e.olibexm.a: $(OBJS) ar ru libexm.a $(OBJS) ranlib libexm.aclean: rm -f core *.o libexm.a.SUFFIXES: .c .o.c.o: $(CC) $(CFLAGS) -I ./include/ -c ./src/$*.cderle: gcc -g -I ./include/ -o ./bin/test ./src/a.c ./lib/libexm.a -lm
a is mine main c file. b, c, d and e are library's ones as you can see. I need to store them in exactly where they are belong to. Like headers must be in "include" file, objects in "objs" etc. . And most important thing is my library(.a) must be in "lib" file after compiled. My main problem is how can I compile my library with using "ar" command and store it to under "lib" file. And of course it's should take objects files from "objs" file.My file order is like: