[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs users a dying breed?
From: |
Dan Espen |
Subject: |
Re: Emacs users a dying breed? |
Date: |
Sat, 23 Jun 2012 20:16:46 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
notbob <notbob@nothome.com> writes:
> On 2012-06-21, Ken Goldman <kgoldman@us.ibm.com> wrote:
>
>> I think Pascal was saying that you Makefile (not /usr/bin/make) might
>> not be in the same directory as your code.
>>
>> If you don't have a makefile there, you can also do 'make -f
>> pathtomakefile' and emacs will remember it for the next time.
>>
>> If you don't have a makefile at all, it's time to create one.
>>
>> Bonus: Check out M-x next-error. I have both compile and next-error
>> bound to Fn keys since I use them constantly.
>
> OK. I'll risk looking stupid one more time. ;)
>
> What, exactly, is this "Makefile"?
A Makefile is a file using that name (Makefile) that you normally keep
in the same directory as your source code. In that file you keep the
rules it takes to build your source code.
Start here for documentation:
http://www.gnu.org/software/make/manual/
The basic idea is to list your files, show how they inter-relate and are
used to build your project.
A simple example of a Makefile:
SRC:=hello.c
TARG:=$(subst .c,,$(SRC))
all: $(TARG)
%: %.c
cc $< $@
test: $(TARG)
./$(TARG)
Anything starting in column 1 and ending in a ":" is a target.
(Something you want to make.)
Things listed after the colon (":") are things you need to make
the target.
Things following a TAB in column 1 are rules. The rules you need
to make the target.
Makefiles can get a lot more elaborate and can do a lot of things
for you. If you need to compile 3 subroutines for a main before
you link the main, the makefile can ensure that you do that.
Anyway, it's definitely worth the time to learn and a great
productivity booster. It's also not only for building programs.
I use them to upload web pages to a server.
For example:
UP_SITE:=ftpmysite.somewhere.net
uploads:=$(wildcard *.jpg *.html *.gif *.css )
targets:=$(addprefix .upload/,$(uploads))
all: $(targets)
define install_html
(\
echo -e "binary\n"\
"cd deck\n"\
"put $(subst .upload/,,$@)\n"\
"close\n"\
"quit\n"\
) | ftp $(UP_SITE)
endef
.upload/%: %
$(install_html)
echo "`date`" > $@
clean:
rm .upload/*
--
Dan Espen
- Re: Emacs users a dying breed?, (continued)
- Re: Emacs users a dying breed?, Jeremiah Dodds, 2012/06/17
- Message not available
- Re: Emacs users a dying breed?, Dan Espen, 2012/06/18
- Re: Emacs users a dying breed?, Henri-Paul Indiogine, 2012/06/18
- Re: Emacs users a dying breed?, notbob, 2012/06/18
- Re: Emacs users a dying breed?, Pascal J. Bourguignon, 2012/06/18
- Re: Emacs users a dying breed?, notbob, 2012/06/18
- Re: Emacs users a dying breed?, Ken Goldman, 2012/06/21
- Message not available
- Re: Emacs users a dying breed?, rusi, 2012/06/21
- Message not available
- Re: Emacs users a dying breed?, notbob, 2012/06/23
- Re: Emacs users a dying breed?,
Dan Espen <=
- Re: Emacs users a dying breed?, Dvorak Hemialgia, 2012/06/21
Re: Emacs users a dying breed?, Laurent Hoeltgen, 2012/06/18
Re: Emacs users a dying breed?, Thien-Thi Nguyen, 2012/06/18
Re: Emacs users a dying breed?, Sivaram Neelakantan, 2012/06/18
Re: Emacs users a dying breed?, Pascal J. Bourguignon, 2012/06/17
Re: Emacs users a dying breed?, Susan Cragin, 2012/06/18