Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » 2 newbie Makefile questions

This thread is locked; no one can reply to it. rss feed Print
 1   2 
2 newbie Makefile questions
William Labbett
Member #4,486
March 2004
avatar

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
Second in Command
February 2005
avatar

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

Either Makefile or makefile will do (no extension).

They all watch too much MSNBC... they get ideas.

William Labbett
Member #4,486
March 2004
avatar

cheers Arthur.

How do I save it with no extension ?

Arthur Kalliokoski
Second in Command
February 2005
avatar

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

Save As -> "makefile"

They all watch too much MSNBC... they get ideas.

William Labbett
Member #4,486
March 2004
avatar

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
Member #5,313
December 2004
avatar

How do I save it with no extension ?

Don't use Notepad.

bamccaig
Member #7,536
July 2006
avatar

LennyLen
Member #5,313
December 2004
avatar

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
Second in Command
February 2005
avatar

Obviously Windows knows best.

They all watch too much MSNBC... they get ideas.

torhu
Member #2,727
September 2002
avatar

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

Arthur Kalliokoski
Second in Command
February 2005
avatar

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.

They all watch too much MSNBC... they get ideas.

Thomas Fjellstrom
Member #476
June 2000
avatar

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

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

BAF
Member #2,981
December 2002
avatar

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
Second in Command
February 2005
avatar

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.

They all watch too much MSNBC... they get ideas.

bamccaig
Member #7,536
July 2006
avatar

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
Second in Command
February 2005
avatar

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.

They all watch too much MSNBC... they get ideas.

William Labbett
Member #4,486
March 2004
avatar

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
Member #476
June 2000
avatar

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.

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

Arthur Kalliokoski
Second in Command
February 2005
avatar

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.

They all watch too much MSNBC... they get ideas.

bamccaig
Member #7,536
July 2006
avatar

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
Member #8,381
March 2007
avatar

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
Member #2,981
December 2002
avatar

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
Member #476
June 2000
avatar

BAF said:

Or, use a better editor than notepad.

I choose to use a better OS ;)

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

Kthanid
Member #12,218
August 2010
avatar

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

BAF
Member #2,981
December 2002
avatar

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. ::)

 1   2 


Go to: