Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » damn these make files

This thread is locked; no one can reply to it. rss feed Print
 1   2   3   4 
damn these make files
IronBob
Member #3,248
February 2003
avatar

ive never liked make files. my first experience was installing allegro. i think matthew should remember that one. but now that everything is installed correctly im doing fine. took me a while but its all in place. i got allegro (of course), allegrogl (for when i start to learn 3d), audlib (to load sound files as SAMPLE's that are 1/4 of the size of a wave file yet still have the same quality), and libnet (for networking).

damage
Member #3,438
April 2003

Hmmm, I'm late to this thread, but I'll just say that I agree with Korval. Unix is full of these one-use-only utilities that are too powerful for their own good. It's a better idea just to spend your (valuable) time learning a general purpose scripting language.

Don't learn Perl unless you like writing obfuscated code. Learn Python; it's the way of the future.

____
Don't have anything private. Don't do anything silly like having a hidden name and address field with get_name and set_address and get_name and set_name functions. - Bjarne Stroustrop, creator of C++

kazzmir
Member #1,786
December 2001
avatar

I dont know what this thread is about anymore cuase ive only read the first 50 or so posts, but id just like to say Makefiles are incredibly simple. They are nothing more than variable declarations and dependency checks. Here is a makefile with as complex structure as you will ever see.

CODE = file.o
PROGRAM = game

${PROGRAM}: ${CODE}
   gcc ${CODE} -o ${PROGRAM}

CODE is a variable. PROGRAM is a variable. The only usefull line in there is the dependecy check which says, "If ${CODE} exists, then do whatever the next line for ${PROGRAM} is.". These concepts arent very hard and anyone who can understand the C language can certainly understand makefiles.

That being said, Makefiles become insanely complex when you add all sorts of bash command line stuff to it. That and if you dont understand the command line arguements to gcc itself then you probably wont understand the garbage written in most makefiles. Those are two different things, however, so people should stop complaining about makefiles and start complaining about gcc and bash.

Bruce Perry
Member #270
April 2000

Quote:

Here is a makefile with as complex structure as you will ever see.

Are you sure about that? ;)

You forgot to account for how GNU Make deals with Makefiles that include files they generate, the difference between variables assigned with := and =, how special targets like .PHONY work, how functions can be called and defined, when variables are evaluated ...

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

23yrold3yrold
Member #1,134
March 2001
avatar

Actually, Ben, I think I might be able to learn from that (I didn't know rules could have multiple commands like that). You want a scary makefile, Allegro's is still the king ;D Well, last time I looked at it ...

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Bruce Perry
Member #270
April 2000

Quote:

"If ${CODE} exists, then do whatever the next line for ${PROGRAM} is."

It's actually more like, "If ${PROGRAM} doesn't exist, or is older than ${CODE}, then first make sure ${CODE} exists (build it if possible) and then execute the following commands which are designed to (re)build ${PROGRAM} from ${CODE}."

Another thing that makes Makefiles so unapproachable to newcomers is that within the rule, $@ can replace ${PROGRAM} above and $^ or $< can replace ${CODE}. There are lots of such 'automatic variables'.

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

kazzmir
Member #1,786
December 2001
avatar

Ok, i did a bad job explaining how makefiles work. I didnt know there was a difference between := and =, i just thought it was syntactical sugar to make pascal and C people happy :).

Besides, the things you have mentioned dont make makefiles that much more complicated. Its definately not as hard to read a makefile as it is to read someones undocumented code even if cleanly written.

CGamesPlay
Member #2,559
July 2002
avatar

I did all of my development on VC++ 5.0 until about 6 months ago. Then I made the big leap and put Linux on my computer. I know all about VC++, and make, and it took me about a week to pick up on makefiles. Now I use autoconf, which I am still learning, but it allows me to automatically generate makefiles for multiple projects at once, and automatically configures it for use with various add-ons (flex and bison, mainly). I think makefiles could be better, and I would definately try out a C-like makefile language, but in the meantime, I'm quite happy with it.

Also, I, since getting a cross-compiler, can produce my win32 binaries without even using windows! For demonstration purposes, my makefile.am (which generates Makefile) and configure.in (which writes a configure script):

1# Makefile.am:
2# The binaries to make:
3bin_PROGRAMS = diary dedit
4 
5# options for the binaries:
6diary_SOURCES = diary.cpp memory.cpp global.cpp LocalSettings.cpp
7diary_LDADD = -lalleg-4.0.3 -lalleg_unsharable
8 
9dedit_SOURCES = dedit.cpp memory.cpp global.cpp LocalSettings.cpp
10dedit_LDADD = -lalleg-4.0.3 -lalleg_unsharable
11 
12# file to add to the source-distribution
13EXTRA_DIST = \
14camera.h diary.cpp global.cpp LocalSettings.h memory.h \
15config.h gfx/EditorData.dat global.h map.h object.h \
16dedit.cpp gfx/MenuData.dat LocalSettings.cpp memory.cpp player.h
17 
18# configure.in:
19AC_INIT
20# This line makes a config.h, with some neato defines in it such as whether
21# yytext (for lex) is a pointer, and the name and version of the package.
22AM_CONFIG_HEADER(config.h)
23# LTLN is the project name, 0.1 is the version.
24AM_INIT_AUTOMAKE(LTLN, 0.1)
25# Use these options:
26AM_PROG_LEX
27AC_PROG_YACC
28AC_PROG_CXX
29AC_PROG_INSTALL
30# Write the makefile:
31AC_OUTPUT(Makefile)

Very simple, then I run one command "autoreconfigure" and everything is ready to be UNIX-style installed... I haven't tried using that makefile on windows, but I can change the LDADD flags to "-lalleg" and run:
CXX=/usr/local/cross-tools/i386mingw32msvc/bin/g++ ./configure
To compile as a win32 project.

[edit]
I'm dumb!... Looking back, I started this whole argument, then managed to avoid it until it had well cooled down... ::)

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

IronBob
Member #3,248
February 2003
avatar

hey what about this. we dont use make files at all and use visual installers. everyone with me now, YAAAAYYYY NO MORE MAKE FILES!!! wooohoo. just open an exe and it compiles and places it in the right spot.

Bruce Perry
Member #270
April 2000

Enjoy running your visual installer every time you make a minor change in your project, IronBob.

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

IronBob
Member #3,248
February 2003
avatar

or how about you just change the files that are already installed.

Bruce Perry
Member #270
April 2000

Last time I looked, it was possible to download diff files for Allegro. Happy? :P

Anyway you misunderstood. I'm talking about the minor changes you would make if you were working on Allegro itself. Enjoy running your visual installer every time you make such a change.

With the Makefile, you can make a minor change and then type 'make', and it will recompile just the bits you've changed.

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

IronBob
Member #3,248
February 2003
avatar

you dont do that. you do a visual installer for a major version. not one tiny little change. you make a whole bunch of tiny changes and you put it in a patch. then if you get a whole bunch of major changes then you make a new version and put out a visual installer. you dont make a new visual installer for each little patch. you just replace the files with new ones. for yourself if your changing it you wouldnt need to use a make file, just compile it inside your project.

Bruce Perry
Member #270
April 2000

Better yet: use Makefiles (or MSVC project files if you like). They enable you to recompile just the stuff that changes, and they serve as the major part of the installation when you decide to release your project. Less work. And since you're not paying the developers, even that is more than you can expect.

There was a time when I actually wrote software for me. I never released anything. I didn't know what the Internet was. Those were the days :)

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

IronBob
Member #3,248
February 2003
avatar

you can automatically compile only the things that change anyway. and you totaly dont realize what i just said. make files are nothing compared to a visual installer. if you are going to use a make file atleast have something slightly visual to do it for the people that arent as computer perfect. its so damn annoying to spend 3 hours just to get one darn thing to compile and installed. and atleast people can tell you what you need before you install if not GIVE IT TO YOU. so that way you dont have to spend forever looking for some remote thing that was made in the early 90's and never heard of again. that person just had it laying around and decided since no one else was using it they would. then theyll give out their stuff without that one essential component and give a crappy readme that might give you a broken link on where to find it. just include everything needed and only whats needed. it doesnt matter if your one file is big to download. they user will have to download everything else some other place anyway. its just so annoying to spend a whole damn day getting a few things working.

Mars
Member #971
February 2001
avatar

Quote:

you can automatically compile only the things that change anyway.

That's what makefiles are meant to do. You don't seem to understand the complexity of dependencies projects can reach. If makefiles aren't used then other means are employed that do the same thing, e.g. the project managment of an ide.

--
This posting is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and in no way are to be considered flaws or defects.

Bruce Perry
Member #270
April 2000

IronBob, you'd spend longer if you had to write that stuff from scratch.

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

Don't learn Perl unless you like writing obfuscated code. Learn Python; it's the way of the future.

BLASPHEME!!!!! The cleanliness of the code is ONLY dependant on the person writing it.

Personally, Python isn't a good option unless you like being told what you can and can't do, ALL the time.

IronBob: If you can't figure out "make && make install" you shouldn't be a programmer.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

23yrold3yrold
Member #1,134
March 2001
avatar

Quote:

The cleanliness of the code is ONLY dependant on the person writing it.

Not the person designing it? ;)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Thomas Fjellstrom
Member #476
June 2000
avatar

I don;t know about you, but IF someone hands me a crappy design, I do my best to clean it up :P

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Evert
Member #794
November 2000
avatar

Quote:

Unix is full of these one-use-only utilities that are too powerful for their own good. It's a better idea just to spend your (valuable) time learning a general purpose scripting language.

Have you ever actually needed any of that power (for scientific work, for instance)? I doubt it, because if you had, you wouldn't be so quick to dismiss those utilities.
Oh, and there's nothing specifically UNIX about most of them, other than that they are usually installed by default on UNIX workstations and need to be installed manually on Windows.

Quote:

make files are nothing compared to a visual installer.

Yes they are. They're platform independent. They also work from a dumb terminal and work without further user intervention.

Quote:

and atleast people can tell you what you need before you install if not GIVE IT TO YOU

Poor documentation has nothing whatsoever to do with makefiles.

Quote:

just include everything needed and only whats needed.

You really want everyone here who release their sourcecode to include the source to Allegro? Wow. :o
This is also a bad idea because you need to update your distribution whenever a newer version of some package comes out (unless you don't care about bugfixes, of course).

Quote:

it doesnt matter if your one file is big to download. they user will have to download everything else some other place anyway.

It does matter if you're on dialup and pay by the minute. If I need to download a lot of extra stuff, I'll take a box of floppies with me to university. Then there's always the chance that I in fact already have what I need, in which case I'm going to be very annoyed if I spend ten minutes downloading something I already have (again, I pay by the minute).

Bruce Perry
Member #270
April 2000

Referring to Makefiles, Evert said:

They're platform independent.

I only wish that were true. It takes some work to get a Makefile to work on multiple Unix variants. For instance, BeOS puts include files in boot/develop/headers and libraries in boot/develop/lib/x86. It takes even more work to get a Makefile to work on Windows too, or even to work on all Windows systems (with no consideration for Unix) ...

The autotools cover the Unix variants - but they are very ugly and unapproachable, and don't help with Windows at all. (This may be changing; MSYS claims to be able to make configure scripts work on Windows, but I haven't tried this.)

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Karadoc ~~
Member #2,749
September 2002
avatar

BP (about makefiles being platform independent) said:

I only wish that were true. It takes some work to get a Makefile to work on multiple Unix variants. For instance, BeOS puts include files in boot/develop/headers and libraries in boot/develop/lib/x86. It takes even more work to get a Makefile to work on Windows too, or even to work on all Windows systems (with no consideration for Unix) ...

But that's not the makefile being platform dependant, it's just different OSs having their files in different places.
You'd have to deal with that no matter what you used really.
Unless, of course, it doesn't effect whatever you are compiling. Like the stuff I make, just games and other smaller projects. They don't care about where include files are, just so long as gcc can find them.

-----------

Evert
Member #794
November 2000
avatar

Quote:

I only wish that were true. It takes some work to get a Makefile to work on multiple Unix variants. For instance, BeOS puts include files in boot/develop/headers and libraries in /boot/develop/lib/x86/.

Shouldn't the install script cover that on *nix? I haven't ever had the need to use it yet, so I'm not sure here...
Even then, however, a makefile can be used or made appropriate easily enough for different platforms. There is no standard way to write a graphical installer that runs on Windows, Linux, Solaris, HP-UX, DOS, BeOS, QNX, OSX... which sortof was my point.
(I also assumed IronBob was referring to something like a Win32 self extracting archive, which he might not have been, but which certainly is a no-no for platform independence).

IronBob
Member #3,248
February 2003
avatar

make and make install is no where near the only thing you have to do. i had to find unix tools, get help on how to change the make file from linux to windows, get pthreads, move and rename a bunch of make files, get some evtra thing libnet and then install it all. all of it took me about 3 hours. its ok to use a make file when you are editing the project yourself but when you put out a major version its just annoying. you know all of those "help installing allegro" threads (including mine). that would pretty much all be gone if you include all the files and a visual installer. and for those who want to change the make file just have the installer run the make file. that way others can use the make file if they want to and the computer noobs can use the visual installer.

 1   2   3   4 


Go to: