🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.misc.discuss
Article #2277

GNUmake question

#2277
From: Deyoung Hong
Date: Thu, 13 Aug 1998 00:00
23 lines
1174 bytes
I want to write a general rule for SRC to OBJ where
	SRC = a.c ../b.c sub/c.c
and
	OBJ = obj/a.o ../obj/b.o sub/obj/c.o
i.e., the obj dir is inserted before the file.

Note that SRC contains source files in different directories.
How do I write a general make rule for it?
I tried (ideally) this but that doesn't work:

%.o: $(subst obj/,,%).c
	echo compile $< into $@

[ It meant to say that:
	obj/a.o: a.c
	../obj/b.o: ../b.c
	sub/obj/c.o: sub/c.c
]

Can someone help?

Thanks,
deyoung.hong@cisco.com
Technical Details
Message-ID: <35D36BE6.89C653A6@cisco.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,457c97cafa25d3a0,start
X-Google-Attributes: gid11318c,public
X-Google-Thread: fa261,457c97cafa25d3a0,start
X-Google-Attributes: gidfa261,public
X-Google-Thread: 1025b4,457c97cafa25d3a0,start
X-Google-Attributes: gid1025b4,public
From: Deyoung Hong <hong@cisco.com>
Subject: GNUmake question
Date: 1998/08/13
Message-ID: <35D36BE6.89C653A6@cisco.com>
X-Deja-AN: 380906649
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
Organization: Cisco Systems
Mime-Version: 1.0
Reply-To: @cisco.com
Newsgroups: gnu.misc.discuss,gnu.gcc.help,gnu.utils