[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
exporting header files before compiling submakes
From: |
Alexander Farber |
Subject: |
exporting header files before compiling submakes |
Date: |
Fri, 27 Aug 2004 11:58:55 +0000 |
User-agent: |
Mutt/1.4.1i |
Hi,
this probably a frequent situation: I have a couple of header files,
which should be exported before I go through the sub-makefiles.
I wonder how to perform the creation of the export directories best.
Here is my testcase with 2 header files to be exported:
bolinux72:exp-test {570} mkdir src
bolinux72:exp-test {571} touch src/pnmsg.h src/pnmsg.inl
bolinux72:exp-test {569} cat Makefile
SUBMAKES =
EXPFILES = include/pnmsg.h \
include/internal/pnmsg.inl
EXPDIRS = $(dir $(EXPFILES))
all: export
clean: rm_files rm_dirs
all clean: $(SUBMAKES)
for sub in $(SUBMAKES); do \
$(MAKE) -f $$sub $@; \
done
export: $(EXPDIRS) $(EXPFILES)
$(EXPDIRS):
mkdir -p $@
rm_files:
rm -f $(EXPFILES)
rm_dirs:
-rmdir $(EXPDIRS)
.PHONY: all export clean export rm_files rm_dirs
include/pnmsg.h: src/pnmsg.h
cp -f "$<" "$@"
include/internal/pnmsg.inl: src/pnmsg.inl
cp -f "$<" "$@"
It seems to run ok:
bolinux72:exp-test {572} gmake
mkdir -p include
mkdir -p include/internal
cp -f "src/pnmsg.h" "include/pnmsg.h"
cp -f "src/pnmsg.inl" "include/internal/pnmsg.inl"
for sub in ; do \
gmake -f $sub all; \
done
And even if I create a file in an export dir,
the copying doesn't start again:
bolinux72:exp-test {573} ls -ld include/
drwxr-xr-x 3 afarber nmpbo 4096 Aug 27 12:35 include/
bolinux72:exp-test {574} touch include/xxx
bolinux72:exp-test {575} ls -ld include/
drwxr-xr-x 3 afarber nmpbo 4096 Aug 27 12:38 include/
bolinux72:exp-test {576} gmake
for sub in ; do \
gmake -f $sub all; \
done
I wonder it it's ok this way or if I should list the $(EXPDIRS)
as an "order-only" prerequisite (but for what reason?).
And also, if I would list the $(EXPDIRS) as "order-only", how
do I still make sure that $(EXPDIRS) are made before $(EXPFILES)?
export: $(EXPFILES) | $(EXPDIRS)
- has a wrong order, doesn't it?
And one more question is if there is a way to solve cleaning
up the created dirs. Sort them by their length and call "rmdir"?
Thanks for any hints and suggestions
Alex
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- exporting header files before compiling submakes,
Alexander Farber <=