help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

makefile for generating exe from single cpp


From: Amit Chaudhuri
Subject: makefile for generating exe from single cpp
Date: Fri, 17 Oct 2014 07:46:56 +0100

Hi,

my reading of the manual for GNU make (v3.82) was that a simple
makefile consisting of:

main: main.o

in a project consisting of a single main.cpp file would invoke g++ and generate
.o from .cpp and main by linking with g++. This is not what I see and
it comes as
a surprise.

The first implicit rule picked up is to link main from main.o with cc
rather than g++.

I can work around this by specifying a rule such as $(LINK.cc) -o $@
$< but I'm wondering if I'm missing something.

My question is "what is the most robust/concise way to write a
makefile for generating cpp applications from a single cpp file?"

Regards,


Amit



reply via email to

[Prev in Thread] Current Thread [Next in Thread]