Author Topic: Makefiles  (Read 2839 times)

Offline themuffinman

  • Carpal Tunnel Member
  • ******
  • Posts: 1935
    • View Profile
  • Rated:
Makefiles
« on: August 24, 2011, 12:04:59 AM »
Howdy y'all!

I've been battling to compile a few different mods (talking about a full compile with client, not just dll's) with MingW and WinXP.

Here's what I get when trying to compile KMQuake2:
Code: [Select]
Makefile:235: *** commands commence before first target.  Stop.

Here's the source code: http://kmq2.quakedev.com.site-no-longer-exists.bad/files/kmquake2_020_b3_htfx3_src.7z
When opening the makefile in a text editor it says it's a linux makefile :/ Anyway to get it to compile with XP?

EGL gives me a bunch of errors involving structs and types etc and I don't know how to dump the text to file, but here's the source:
http://egl.quakedev.com.site-no-longer-exists.bad/files/egl-v0.3.1-stable-src.zip

What am I doing wrong? I can compile ioQuake3 quite fine, Q2 mods shouldn't be too different. Also, is there a tutorial on how to write one's own makefile? Reading through a makefile mostly confuses the crap out of me.

Edit: Come to think of it, Q2Evolved also wouldn't compile, even after following the step-by-step instructions it comes with.


[Admin: Changed quakedev.com links, as the site no longer exists, and leads to adware or worse.]
« Last Edit: April 29, 2017, 04:38:53 PM by Admin »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1371
    • View Profile
  • Rated:
Re: Makefiles
« Reply #1 on: August 24, 2011, 12:38:37 AM »
Makefiles are tough. They have to be written in the proper order and the position of the items in the lines is very important, white space is VERY important because make files have to be tabbed and spaced correctly. Not recommended for beginners.

The kmquake2 source has Visual Studio projects in it. Get VS2005, 2008 or 2010 and open those projects with the IDE. Then you don't have to deal with makefiles.

If you have a Linux box then all you need to do is cd to the linux directory of the project and type make. (assuming the make file doesn't have bugs. old code and old make files on newer Linux isn't compatible) You can't use a linux make file on Windows.

The EGL sources are more complicated. They don't include the VS project files so you will have to create them yourself, also not for beginners.

I don't know MingW enough to guide you in it.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline themuffinman

  • Carpal Tunnel Member
  • ******
  • Posts: 1935
    • View Profile
  • Rated:
Re: Makefiles
« Reply #2 on: August 24, 2011, 01:24:43 PM »
Thanks for the reply. That sounds rough. I've got nothing but respect for expert programmers - the stuff is like rocket science! I've got some C/C++ e-books that I still have to read through. It's fascinating how complicated it is!

Maybe it's time for me to upgrade from VC++ 6.0 :D I know someone who might sell me their old 2005 for cheap so I'll give that a shot.

How about Q2E - here's the source: http://sourceforge.net/projects/q2e/ I followed the compiling instructions perfectly and it still won't work :/
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1371
    • View Profile
  • Rated:
Re: Makefiles
« Reply #3 on: August 24, 2011, 06:58:14 PM »
That Makefile is pretty current and is more extensive than most. It has some nice features but I couldn't get it to finish the build on my OS X system but that isn't very surprising. :) This beasty depends on MingW and MSYS environment and the LibDev which I don't have. I did get lots of the game DLL files to compile though.

You can download the Express version of Visual Studio for free from the Microsoft site. It will work for building Q2 and the DLL's. You might want to use 2005 or 2008 to convert from VC++ 6.0 before doing 2010, the conversion from 6.0 to 2010 can be painful.

If you are already on VC 6.0 then most of these projects should have been easy to get compiled since that is very close to the original environment Q2 was built with.

I am not at home so I don't have the tools needed to follow up on what's more deeply wrong with the process.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline themuffinman

  • Carpal Tunnel Member
  • ******
  • Posts: 1935
    • View Profile
  • Rated:
Re: Makefiles
« Reply #4 on: September 11, 2011, 01:55:59 PM »
Alright I managed to download VC++ 2010 Express, and damn it is a whole lot easier to use!

Now I went and got r1ch's entdump code, which is just one C source file. I modded it to work with Q3 and QL maps but how the hell do I compile it? I tried making a new solution for a Win32 console app or something like that and ended up with a C++ solution that wouldn't compile.

Here's the file...
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1371
    • View Profile
  • Rated:
Re: Makefiles
« Reply #5 on: September 11, 2011, 06:00:56 PM »
It sounds like you didn't create the proper project for your source. The default for VS is to create MFC projects and this is wrong for plain vanilla command line tools like entdump.

Here's how to create a new command line application in VS:
Open Visual Studio and from the start page select New Project
Select Win32 Console Application and then hit the tab key
Enter the name of the new project, then click OK.
In the application wizard dialog, click Next. (DON'T click Finish!)
The Console Application radio button will be selected, leave it that way.
Turn on the Empty Project check box, then click Finish. (This kills MFC and PCH options.)
Select Source Files in the Solution Explorer window and right click to open the Add New Item dialog.
Add a C++ file, you can name it .cpp or just .c, VS will compile .CPP files with the c++ compiler and .C with the C compiler. (You can rename the file in the solution explorer if you screw up.)
Now you have a blank file to add your code. Copy-paste your code into it.

If you copy the source file(s) into the project folder, you can use Add Existing Item instead.

 
Here are some other things to do to your source file:

Add
Code: [Select]
#ifdef _WIN32
#pragma warning (disable : 4996)
#endif
To the top of your source file just below the includes, this will stop the silly warnings about unsafe functions.

Modify the top of main():
Code: [Select]
if(argv[1] != NULL)
in = fopen(argv[1], "rb");
else
{
fprintf (stderr, "FATAL ERROR: No file name specified.\n");
return EXIT_FAILURE;
}
if (!in)
{
fprintf (stderr, "FATAL ERROR: fopen() failed.\n");
return EXIT_FAILURE;
}
...

This checks that argv[1] exists and exits if not, instead of null pointer error.
Use the standard constants EXIT_FAILURE and EXIT_SUCCESS instead of exit(1) or exit(0), etc.

Likewise at end of main():
Code: [Select]
free (buf);
fclose (in);
return EXIT_SUCCESS;
}

« Last Edit: September 11, 2011, 06:47:28 PM by QwazyWabbit »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline themuffinman

  • Carpal Tunnel Member
  • ******
  • Posts: 1935
    • View Profile
  • Rated:
Re: Makefiles
« Reply #6 on: September 17, 2011, 06:49:25 AM »
Thanks! Got it to compile. Too bad it doesn't work though, I was convinced it would! I guess there's more to it than changing the lumps listing and extents. Ah well, decompiling maps does the job.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

 

El Box de Shoutamente

Last 10 Shouts:

 

|iR|Focalor

November 06, 2024, 03:28:50 AM
 

RailWolf

November 05, 2024, 03:13:44 PM
Nice :)

Tom Servo

November 04, 2024, 05:05:24 PM
The Joe Rogan Experience episode 223 that dropped a couple hours ago with Musk, they're talking about Quake lol.
 

Costigan_Q2

November 04, 2024, 03:37:55 PM
Stay cozy folks.

Everything is gonna be fine.
 

|iR|Focalor

October 31, 2024, 08:56:37 PM
 

Costigan_Q2

October 17, 2024, 06:31:53 PM
Not activated your account yet?

Activate it now! join in the fun!

Tom Servo

October 11, 2024, 03:35:36 PM
HAHAHAHAHAHA
 

|iR|Focalor

October 10, 2024, 12:19:41 PM
I don't worship the devil. Jesus is Lord, friend. He died for your sins. He will forgive you if you just ask.
 

rikwad

October 09, 2024, 07:57:21 PM
Sorry, I couldn't resist my inner asshole.
 

Costigan_Q2

October 09, 2024, 01:35:05 PM
Et tu rikwad?

Please don't feed the degenerate lies of a sexually-perverted devil-worshipping barking dog like Focalor.

Show 50 latest
Welcome, Guest. Please login or register.
November 10, 2024, 07:35:19 AM

Login with username, password and session length