makefile and notdir
Brownie <[email protected]> Fri, 24 Jul 2009 06:42:16 -0700 (PDT)
| Newsgroups | gmane.comp.gnu.utils |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <9fb522ba-6704-4d51-93a9-18eb04f4db10@k30g2000yqf.googlegroups.com> |
Hello, I try to do a makefile for a program with several sources. It's working if all sources are in the same folder with the makefile SRC -> file with all f90 and the makefile OBJ -> objects directory MOD -> modules directory the list of objects is generated as follow OBJDIR = ../obj SRCS= \ ./TYP_DateJJSecPico_mod.f90 \ main.f90 OBJS= $(SRCS:%.f90=$(OBJDIR)/%.o) Now, I would like to access sources from different directories as follows SRC2 -> directory with the new source file toto.f90 SRC -> same as before OBJ -> same as before MOD -> same as before object list is generated as follows OBJDIR = ../obj SRCS= \ ./TYP_DateJJSecPico_mod.f90 \ ../SRC2/toto.f90 \ <=========modif main.f90 OBJS= $(SRCS:%.f90=$(OBJDIR)/%.o) This formulation returns OBJS as follows : ../obj/./TYP_DateJJSecPico_mod.f90 ../obj/../SRC2/toto.o WRONG !! but playing whith $(addprefix $(OBJDIR)/,$(notdir $(OBJS))) I obtain ../obj/TYP_DateJJSecPico_mod.f90 ../obj/toto.o GOOD but SRCS has been modified and cut the directory path from each file so my inferences $(OBJDIR)/%.o: %.f90 do not work. Help please, Brownie