Can someone please explain how to create a makefile? I'm somewhat confused by what I've read on the web


what compiler and operating system?

g++ on a linux system

A tutorial that may help here

I would suggest downloading the Makefile copy and then making your changes to the existing Makefile. That is always the easiest way to make sure you do not mess up on the tabs !

i've created my makefile...

it's possible that the argument can be K or q (ex: g++ K blah blah or g++ q blah blah)
How do I put that in my makefile so that it could be either one?

You can use a variable say CFLAGS to set up your compiler option. So you can set CFLAGS to whichever option you need and the make will use that. But you cannot have it be either one, it has to be one or the other.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.