Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22006

extracting library to different path while using ar(1) command in makefile

$
0
0

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:enter image description here


Viewing all articles
Browse latest Browse all 22006

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>