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


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to