help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to recursively make libraries in this example?


From: Peng Yu
Subject: How to recursively make libraries in this example?
Date: Sat, 22 Sep 2007 22:55:49 -0500

Hi

I have the following dir structure.

############################
$ ls *
libdfm-g.a  libdfm-o.a Makefile

abc:
abc.cc  abc-g.o  abc.h  abc-o.o  libdfm-g.a  libdfm-o.a  Makefile

fgh:
fgh.cc  fgh-g.o  fgh.h  fgh-o.o  libdfm-g.a  libdfm-o.a  Makefile
############################

The Makefiles in the subdirs can be generate the .a file in each
subdirs with no problems.

I want the Makefile in the parent dir such that it can run make in
each sub dirs and then link the *.a in all the sub dirs to a .a file
in the parent dir.

Here is the preliminary version. I don't know how to make it work.
Would you please help me?


######not working Makefile
.PHONY: all
SHELL = /bin/bash -O extglob
ARCHIVES_O = $(wildcard */libdfm-o.a)
ARCHIVES_G = $(wildcard */libdfm-g.a)
SUBDIRS = $(filter-out Makefile%,$(wildcard *))
CXX = g++
CC = g++

all:
        @for dir in $(filter-out backup, $(SUBDIRS)); do \
                $(MAKE) -C $$dir; \
        done

all: libdfm-g.a libdfm-o.a
        
libdfm-g.a : $(ARCHIVES_G)
        $(AR) $(ARFLAGS) $@ $<

libdfm-o.a : $(ARCHIVES_O)
        $(AR) $(ARFLAGS) $@ $<
############

Thanks
Peng




reply via email to

[Prev in Thread] Current Thread [Next in Thread]