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

Re: Makefile help



* 2021-07-23 16:10:10+0200, Grzesiek wrote:

> Is it possible to do it using make in a fully automatic way? What I
> mean is that make should find all sub-directories and files in
> source_dir by itself.

"make" doesn't find files. You can use "find" in a Makefile to find all
necessary files and then a Makefile rule to do conversion if the source
is newer than the destination. If you copy the following example
remember to use tab character for indentation in the rules.


    src = $(shell find source_dir -type f -name '*.src' -print)
    dst = $(patsubst source_dir/%.src,dest_dir/%.dst,$(src))

    all: $(dst)

    .PHONY: all

    dest_dir/%.dst: source_dir/%.src
            @mkdir -p $$(dirname $@)
            CMD $< $@

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450

Attachment: signature.asc
Description: PGP signature


Reply to: