unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Lee Sau Dan <danlee@informatik.uni-freiburg.de>
Subject: Re: java and M-x compile
Date: 02 Oct 2005 19:11:23 +0800	[thread overview]
Message-ID: <871x34yy04.fsf@informatik.uni-freiburg.de> (raw)
In-Reply-To: mailman.9226.1128080585.20277.help-gnu-emacs@gnu.org

>>>>> "Peter" == Peter Dyballa <Peter_Dyballa@Web.DE> writes:

    Peter> Am 30.09.2005 um 11:37 schrieb LENNART BORGMAN:

    >> but could make -k work by default, or does it need a makefile?

    Peter> make needs a makefile.

No.   GNUmake  doesn't  require  a  Makefile.  It  has  default  rules
built-in, so that it can handle the trivial cases without a Makefile.

e.g. you  have a source  file called xyz.cc  and you type  "make xyz".
GNUmake will automatically  invoke "g++ -o xyz xyz.cc"  to compile it.

Behind the scene, GNUmake applies the default rule:
        %: %.cc
        #  commands to execute (built-in):
                $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@

where 
        LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
        CXX = g++
and all other variables that occurred above undefined.

This makes it possible  to override certain behaviours without writing
a Makefile.  e.g. "make  CXX=my_c++_compiler xyz" will compile it with
"my_c++_compiler"  instead  of "g++".   I  most  often  use "make  xyz
CXXFLAGS=-O3\  -Wall LDFLAGS=-s"  to compile  an  optimized executable
without debug symbols.

No makefiles are needed for such a simple scenario.


You can have a look at the default rule of GNUmake with "make -p -n".



-- 
Lee Sau Dan                     李守敦                          ~{@nJX6X~}

E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/~danlee

  parent reply	other threads:[~2005-10-02 11:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-30  9:37 java and M-x compile LENNART BORGMAN
2005-09-30 11:28 ` Peter Dyballa
2005-09-30 11:48   ` Lennart Borgman
     [not found] ` <mailman.9226.1128080585.20277.help-gnu-emacs@gnu.org>
2005-10-02 11:11   ` Lee Sau Dan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-09-30 22:32 Nick Roberts
     [not found] <mailman.9218.1128074423.20277.help-gnu-emacs@gnu.org>
2005-09-30 13:07 ` kgold
2005-09-30 15:21   ` Peter Dyballa
2005-10-01 13:10 ` isuy
2005-10-01 13:14   ` isuy
2005-10-01 14:46     ` Lennart Borgman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871x34yy04.fsf@informatik.uni-freiburg.de \
    --to=danlee@informatik.uni-freiburg.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).