help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: java and M-x compile


From: Lee Sau Dan
Subject: Re: java and M-x compile
Date: 02 Oct 2005 19:11:23 +0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

>>>>> "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


reply via email to

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