Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am having the makefile which will create a shared library for limited number of sources,

FLAGS := -fPIC -O3 -g -Wall -Werror
CC := gcc
MAJOR := 0
MINOR := 1
NAME := foo
VERSION := $(MAJOR).$(MINOR)

lib: lib$(NAME).so.$(VERSION)

test: $(NAME)_test
LD_LIBRARY_PATH=. ./$(NAME)_test

$(NAME)_test: lib$(NAME).so
        $(CC) $(NAME)_test.c -o $@ -L. -l$(NAME)

lib$(NAME).so: lib$(NAME).so.$(VERSION)
        ldconfig -v -n .
        ln -s lib$(NAME).so.$(MAJOR) lib$(NAME).so

lib$(NAME).so.$(VERSION): $(NAME).o
        $(CC) -shared -Wl,-soname,lib$(NAME).so.$(MAJOR) $^ -o $@

What changes i have to make, if i have mutiple sources. how can i use wildcard in this.

share|improve this question
    
Questions about development on Ubuntu are on topic, I cannot see how this is not about Ubuntu. That said, stackoverflow.com is probably the better place for your question. –  guntbert Sep 6 '13 at 8:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.