2 newbie Makefile questions
William Labbett

Hi,

after some study of the manual I came up with this :

#SelectExpand
1 2#variables 3 4VPATH = C:\MinGW\lib 5 6objects = main.o load_screen.o 7 8linker_options = -lallegro-5.0 9 10 11 12f_rep_editor : $(objects) 13 gcc -o f_rep_editor $(objects) $(linker_options) 14 15 16main.o : colours.h load_screen.h 17 18 19load_screen.o : colours.h load_screen.h

It's the first makefile I've ever made.

Got a couple of questions:

1. According to the manual mingw32-make looks for a file called Makefile

I called my file Makefile.txt

When I call mingw32-make, it says that no makefile file but when I call

mingw32-make -f Makefile.txt

it finds it.

Wondering what I need to change Makefile.txt to, to get it to find it autometically.

The other question is about getting the object files linked to libraries.

I need to link to these files.

C:\MinGW\lib\liballegro.dll.a;
C:\MinGW\lib\liballegro_ttf.dll.a;
C:\MinGW\lib\liballegro_primitives.dll.a;
C:\MinGW\lib\liballegro_font.dll.a

Can anyone help me with that ?

Arthur Kalliokoski

Wondering what I need to change Makefile.txt to, to get it to find it automatically.

Either Makefile or makefile will do (no extension).

William Labbett

cheers Arthur.

How do I save it with no extension ?

Arthur Kalliokoski

Windows automatically puts the .txt extension on it? Use quotes

Save As -> "makefile"

William Labbett

sweet

EDIT : that's something we say in UK. Could have just said Thanks.

Anyway, got the libraries linked now.

Changed makefile to :

#SelectExpand
1#variables 2 3VPATH = C:\MinGW\lib\ 4 5objects = main.o load_screen.o 6 7linker_options = -lallegro.dll -L C:\MinGW\lib\ 8 9 10f_rep_editor : $(objects) 11 gcc -o f_rep_editor $(objects) $(linker_options) 12 13 14main.o : colours.h load_screen.h 15 16 17load_screen.o : colours.h load_screen.h

LennyLen

How do I save it with no extension ?

Don't use Notepad.

bamccaig

IIRC, Notepad can also save without an extention if you select "All files" first. :)

LennyLen
bamccaig said:

IIRC, Notepad can also save without an extention if you select "All files" first.

Nope, even then it still adds a .txt

Arthur Kalliokoski

Obviously Windows knows best.

torhu

IIRC, you can just add a dot at the end of the file name to disable the automatic extensions.

Arthur Kalliokoski

And don't you just love it when you want to edit it again, you can't just double-click it without an extension without getting the "Open with" dialog. Maybe it's just best to leave it as makefile.txt.

Thomas Fjellstrom

IIRC If you also tell windows to display extensions for all file types notepad should allow you to enter the full filename after selecting "All Files".

BAF

Just type in "Makefile." (with the quotes) like torhu said. Easy as that.

You all love to hate on Windows, but in all reality, how often do most people need to save a file without an extension? It doesn't make sense not to add the default extension automatically - very few people actually want to know and type the correct extension whenever they save.

Arthur Kalliokoski

I suppose you could always get the make source and change it to accept makefile.txt as the default, since you can't get the Windows sources. Maybe one of those third party shells would know what to do with no extension though.

bamccaig
BAF said:

You all love to hate on Windows, but in all reality, how often do most people need to save a file without an extension? It doesn't make sense not to add the default extension automatically - very few people actually want to know and type the correct extension whenever they save.

I don't even add an extension to text files. ::) Why would I? That should be the default type assumed by the system. And as a general rule, file extensions shouldn't be trusted anyway. If I'm not sure what type of file I'm dealing with (very rare) then I just ask `file`. Windows can't even deal with files without extensions (it asks you every goddamn time to search through two or three dialogs to find an application to open it with).

Arthur Kalliokoski

I see that even though Russia had the source code to Windows 7 to examine for months, they've decided to go with Linux after all.

William Labbett

How would the bulk of the code for Windows 7 compare with a big triple A game ?

eg Call of Duty Black ops

Thomas Fjellstrom
BAF said:

You all love to hate on Windows, but in all reality, how often do most people need to save a file without an extension? It doesn't make sense not to add the default extension automatically - very few people actually want to know and type the correct extension whenever they save.

The big problem for me is it adding a .txt extension even when I already GAVE the file an extension. Stupid windows.

Arthur Kalliokoski

It's also a huge security hole, i.e. "college_girls_gone_wild.jpg.exe" just shows up as "college_girls_gone_wild.jpg". Of course in Linux even a jpg extension could execute if it had the right permissions, but the user privileges had some thought put into them.

bamccaig

Of course in Linux even a jpg extension could execute if it had the right permissions, but the user privileges had some thought put into them.

Also, from the command line (where I imagine most Linux users spend most of their time; I know I certainly do) you have to explicitly say what you want to happen (which is generally effortless). Even from the GUI, if a file is executable, Gnome always asks me: do I want to "display" this file (i.e., open it) or do I want to execute it? Of course, I almost never let any desktop environment implicitly carry out actions anyway. I generally open the context menu and select what I want to happen.

type568

Since it came down to text editors, I would like to add my 2 cents with notepad++, a text editor used for various programming languages.. Very easy to use, and does what is required to be done.

BAF

The big problem for me is it adding a .txt extension even when I already GAVE the file an extension. Stupid windows.

Use quotes around the filename. That's always been step one to getting the extension you want. Or, use a better editor than notepad.

Thomas Fjellstrom
BAF said:

Or, use a better editor than notepad.

I choose to use a better OS ;)

Kthanid

The big mistake here is using notepad in the first place. Even being saddled with Windows is no excuse for not using Vim.

BAF

I choose to use a better OS

Oh yes, and instead of listening to a better radio station when I don't like what's playing, I buy a brand new car. ::)

Arthur Kalliokoski

A better analogy would be a free luxury car instead of an overpriced Yugo.

BAF

Except that the analogy was applying to the absurd suggestion of changing operating systems to get a better text editor.

Arthur Kalliokoski

But Yugos didn't have a "scan" or "seek" button on their radios! They probably couldn't pull in distant stations very well either.

Thomas Fjellstrom
BAF said:

Oh yes, and instead of listening to a better radio station when I don't like what's playing, I buy a brand new car.

No, instead of listening to a crappy radio station, I listen to a good one.

Tobias Dammers
BAF said:

Except that the analogy was applying to the absurd suggestion of changing operating systems to get a better text editor.

I think the spirit was more along the lines of changing operating systems to get better development tools.
Also, we're talking about makefiles here, a concept that was invented on Unix and still works best when used in a Unix-like environment. Suggesting to switch to a Unix-like platform to get the most out of them does make some sense, although it's probably still overkill.

No, instead of listening to a crappy radio station, I listen to a good one.

Instead of listening to a crappy radio station, I listen to CDs. Only with operating systems, the CDs are free and the radio isn't.

BAF

Yeah, and that spirit is just like suggesting buying a new car to get a better radio.

Switch to a new OS to use a shitty build system anyway... that makes a lot of sense. :P

Arthur Kalliokoski

Let's see what the money-is-no-object scientists type use, shall we?

{"name":"800px-Operating_systems_used_on_top_500_supercomputers.svg.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/c\/7cd696c8987b0fd04795e7b84a034c52.png","w":800,"h":560,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/c\/7cd696c8987b0fd04795e7b84a034c52"}800px-Operating_systems_used_on_top_500_supercomputers.svg.png

BAF

And what is that supposed to prove?

Arthur Kalliokoski

Isn't it obvious on the face of it?

William Labbett

Last time I had linux installed it was Mandriva and I got a message due to trying to run something without permission.

The message said the incident was going to be reported. That's like being spotted stealing something trivial from work and getting grassed up for it.

I thought linux was supposed to be cool. There's a world of difference between being an amiable nerdy tech-enthusiast and complete twat who's life is so devoid of pleasure that he gets a kick out of writing such strings into the kernal of an OS.

Arthur Kalliokoski

I got a message due to trying to run something without permission.

Yes, this is preferable since it doesn't require user intervention.

Thomas Fjellstrom

Last time I had linux installed it was Mandriva and I got a message due to trying to run something without permission.

Must have gotten your password wrong. If you run and app with sudo, and get the password wrong enough times, it'll give you that message and exit.

It actually sends an email to "root", its not about people getting jollies writing "such strings", its about security, and knowing that you can tell when someone is trying naughty things with your box.

Also, its not written into the kernel ::)

BAF

Isn't it obvious on the face of it?

No not really. Just because scientists are using more and more Linux means that everyone else should as well?

Tobias Dammers

Isn't it obvious on the face of it?

It's pseudo-proof. Your arguments is that most scientists use Linux because it is better even when money is meaningless. Your graph shows, if anything, that most scientists use Linux, but it does not provide reasons.
My guess would be that Linux is the OS of choice for entirely different reasons - the most crucial applications for computers, in the scientific world, involve really large computers - clusters where you can reserve a few hundred CPUs with a few dozen terabytes of RAM for a few days straight to perform your calculation. For such computers, a highly modular OS, fully configurable and every part tweakable to the max, to the point that parts of the OS kernel can be rewritten to suit particular needs, is the best choice, and a closed-source OS simply cannot satisfy this. User-friendlyness is relatively unimportant: When you have three days to do your calculation, spending an hour or two on learning command line basics is relatively meaningless.
So the most mission-critical systems run Linux - everything else follows naturally, just like a company that uses SQL Server for their databases is likely to run Windows on everything.

William Labbett

Anyway, sorry about my stupid comment. I'd like to use linux but noone really cares if I use linux or Windows (correct me if I'm wrong) and I find Windows easy. If I ever finish my game I'll be able to compile it for linux seeing as allegro is cross-platform.

Edgar Reynaldo

No one bothered to tell you to open the file from within Code::Blocks. Code Blocks will let you select the line ending type as well as correctly read text files with any line endings. If you create a new file in Code Blocks you'll have to select 'all files' in the save type under the save as dialog and put quotes around the file name, but after that it will save normally.

William Labbett

Nice to see you're back Edgar.

I use Notepad++ anyway, but thanks.

Edgar Reynaldo

Nice to see you're back Edgar.

Cheers, thanks. Good to see some familiar faces. ;)

I use Notepad++ anyway, but thanks.

Does Notepad++ have syntax highlighting? What about project files or compiler and linker options? You should really try Code Blocks. Thanks to this thread I checked their website and version 10.05 came out last May so I downloaded it and I'm going to try it out tomorrow.

bamccaig

Does Notepad++ have syntax highlighting?

Yes.

What about project files...

No.

...or compiler and linker options?

Not really. You should be able to invoke a build file (Makefile, CMake, premake4, scons, etc.) though.

Thread #605911. Printed from Allegro.cc