On 2006-8-27 9:55 UTC, Lin George wrote:
> Here is a sample make file.
> 
> SRC=foo.c
> PROC=$(SRC:%.c=%.o)
> TARGET=$(PROC:%.o=$(TARGET_DIR)/%.o)
> 
> I know the first two lines mean compile *.c defined in
> SRC to *.o. But what does the 3rd line mean? Convert
> *.o generated by PROC rule still to *.o? I am confused
> that why convert *.o to *.o itself?

All three lines simply set variables.

To see exactly what each line does, add a target that
displays each variable:

# 'sample.make' begins
SRC=foo.c
PROC=$(SRC:%.c=%.o)
TARGET=$(PROC:%.o=$(TARGET_DIR)/%.o)

.PHONY: show_variables
show_variables:
        @echo 'TARGET_DIR is $(TARGET_DIR)'
        @echo 'SRC        is $(SRC)'
        @echo 'PROC       is $(PROC)'
        @echo 'TARGET     is $(TARGET)'
# 'sample.make' ends

Then run it this way:
  make --file=sample.make
and also this way:
  make --file=sample.make TARGET_DIR=/bar


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

Reply via email to