[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Passing directory to submake
From: |
Russell |
Subject: |
Re: Passing directory to submake |
Date: |
Sat, 19 Oct 2002 14:23:23 +1000 |
Hi,
I thought i'd solve it using a pattern rule
in each subdirectory:
%.o: %.c %.h
$(CC) $(CFLAGS) -o $@ $<
However, when a file matching %.o does not exist,
make gives an error: *** No targets. Stop.
How can i get 'make' do the command and create
that .o file?
Russell wrote:
>
> Hi all,
>
> SUBDIRS= analog
> .PHONY: $(SUBDIRS) clean proj
>
> proj: $(SUBDIRS)
> cd objs \
> avr-ld -o proj.o -Map proj.map $(addsuffix .o,$(SUBDIRS)) \
> avr-objcopy -O ihex -R .eeprom -g proj.o proj.hex
>
> In the submake below, make is executed in a subdirectory.
> How can i access the name of the subdirectory in this
> submake?
>
> $(SUBDIRS):
> $(MAKE) -C $@
>
> The idea is to be able to use an identical makefile
> in every subdirectory.