[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dynamically building (temp) include file - how to delete on exit?
From: |
gnu_make0 |
Subject: |
Re: dynamically building (temp) include file - how to delete on exit? |
Date: |
Tue, 26 Jun 2012 18:53:28 -0500 |
On Sun 6/17/12 15:30 CDT address@hidden wrote:
--snip
> This uses mktemp. The 'cat' w/in the makefile is only there (temporarily)
> to show what the macro defs are.
>
> $ cat makefile
> TMPF=$(shell tmpf=$$(mktemp /tmp/ddefs.XXXXXXXXX);_29r_dirdefs-make >
> $$tmpf;echo $$tmpf)
above line should be
TMPF:=$(shell tmpf=$$(mktemp /tmp/ddefs.XXXXXXXXX);_29r_dirdefs-make >
$$tmpf;echo $$tmpf)
so mktemp runs just once.
> $(foreach v,$(shell set -- $$(wc -l $(TMPF)); seq $$1),$(eval $(shell sed
> -ne $(v)p $(TMPF))))
>
> $(shell set -x;cat $(TMPF) >&2; :;rm -f $(TMPF))
>
> .PHONEY: bar
> bar:
> @echo _29C: $(_29C)
> @echo _29lib: $(_29lib)
> $ make bar
> + cat /tmp/ddefs.ybJa29425
> _29C = /usr/local/7Rq/commands/cur
> _29c = /usr/local/7Rq/scommands/cur
> _29eloc = /etc/local
> _29lg = /var/local/team/mke/log
> _29lib = /usr/local/7Rq/lib/cur
> _29r = /usr/local/7Rq
> _29rev = cur
> _29team = /etc/local/team/mke
> _29pkg = /usr/local/7Rq/package/cur
> + :
> + rm -f /tmp/ddefs.PdKt29433
> _29C: /usr/local/7Rq/commands/cur
> _29lib: /usr/local/7Rq/lib/cur
> $ ls /tmp/ddefs.PdKt29433
> ls: /tmp/ddefs.PdKt29433: No such file or directory
> $
>
> Above forks a shell and a sed for each line in the macro file,
> so it's inefficient, but I may go ahead and use it.
>
> --
> Tom
Re: dynamically building (temp) include file - how to delete on exit?, Basile Starynkevitch, 2012/06/16