[lug] How do you setup a recursive make?

bdoctor at ps-ax.com bdoctor at ps-ax.com
Mon Jul 23 05:09:29 MDT 2001


Here is an applicable stub:

SUBDIRS = lib server client docs 

        list='$(SUBDIRS)'; for subdir in $$list; do \
          echo "Making $$target in $$subdir"; \
          (cd $$subdir && $(MAKE) $(MAKEFLAGS) $$target) \ 

Order is important, in terms of library dependency.

-brad

> The following is not working. How does one setup a recursive make?
> I want to be able to let individual developers just fill in the directories
> of the tools they need and I'll call make somewhere else in the file.
> 
> ############################ Makefile ###########################
> # User configurable section
> ...
> 
> CORE_DEPS = ../../../basic_services/dm \
>             ../../../basic_services/app \
>             ../../../basic_services/tm \
>             ../../../basic_services/utils \
>             ../../../advanced_services/tlm
> 
> ...
> # End user configurable section
> 
> $(MAIN_TARGET): $(OBJS) 
> 	make -C $(CORE_DEPS)
> 	@echo "Linking $@"
> 	$(VB)$(LD_CMD) -r $(OBJS) $(CSC_OBJ) $(CORE_OBJECTS) -o $@
> 
> ############################ Makefile ###########################
> 
> 
> This produces the following:
> make -C ../../../basic_services/dm ../../../basic_services/app
> ../../../basic_services/tm ../../../basic_services/utils
> ../../../advanced_services/tlm
> make[1]: Entering directory
> `C:\Data\my_cvs\di\sc\fsw\src\core\basic_services\dm'
> make[1]: Leaving directory
> `C:\Data\my_cvs\di\sc\fsw\src\core\basic_services\dm'
> make[1]: *** No rule to make target `../../../basic_services/app'.  Stop.
> make: *** [coredeps] Error 0x2
> 
> 
> 
> Is there a better way to accomplish this?
> We are bound to use make version 3.74.
> 
> 
> --
> David Holshouser
> Software Engineer
> Ball Aerospace & Technologies Corp.
> (303)939-5085  dholshou at ball.com  
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> 




More information about the LUG mailing list