Hello,
I am running under Suse Linux and am putting together some code written
in C. I am not clear on how to create makefiles and was wondering if
there were any "makefile tools" out there. If so, what are the best
ones?
TIA 19 2523
use 'autoconf' & write it's script
[Followups set to comp.lang.c]
milkyway said: Hello,
I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles and was wondering if there were any "makefile tools" out there. If so, what are the best ones?
If you don't want to get into autoconf etc, it's trivial to generate your
own simple makefiles by writing a program in elementary ISO C. Here's a
really, really simple one which you can hack to your heart's content.
#include <stdio.h>
void genflags(void)
{
puts("CC=gcc");
puts("CFLAGS=-W -Wall -ansi -pedantic -O2");
puts("DFLAGS=-g -pg");
}
void makeprg(int argc, char **argv)
{
int i = 0;
printf("%s: %s.o", argv[1], argv[1]);
for(i = 2; i < argc; i++)
{
printf(" %s.o", argv[i]);
}
printf("\n\t$(CC) $(CFLAGS) $(DFLAGS) -o %s %s.o", argv[1], argv[1]);
for(i = 2; i < argc; i++)
{
printf(" %s.o", argv[i]);
}
putchar('\n');
}
void makeobjs(int argc, char **argv)
{
int i = 0;
for(i = 1; i < argc; i++)
{
printf("%s.o: %s.c\n", argv[i], argv[i]);
printf("\t$(CC) $(CFLAGS) $(DFLAGS) -c -o %s.o %s.c\n", argv[i],
argv[i]);
}
putchar('\n');
}
void makeclean(int argc, char **argv)
{
int i = 0;
printf("clean:\n");
for(i = 1; i < argc; i++)
{
printf("\trm %s.o\n", argv[i]);
}
printf("\trm %s\n", argv[1]);
putchar('\n');
}
void makeinstall(int argc, char **argv)
{
printf("install:\n");
printf("\tcp %s /usr/local/bin\n", argv[1]);
putchar('\n');
}
int main(int argc, char **argv)
{
if(argc > 1)
{
genflags();
makeprg(argc, argv);
makeobjs(argc, argv);
makeclean(argc, argv);
makeinstall(argc, argv);
}
else
{
fputs("Usage: makegen progname [sourcename*]\n", stderr);
}
return 0;
}
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
milkyway <d0******@hotmail.com> did eloquently scribble: Hello,
I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles and was wondering if there were any "makefile tools" out there. If so, what are the best ones?
autoconf, automake
:)
should help a bit at least.
--
__________________________________________________ ____________________________
| sp****@freenet.co.uk | |
|Andrew Halliwell BSc(hons)| "The day Microsoft makes something that doesn't |
| in | suck is probably the day they start making |
| Computer science | vacuum cleaners" - Ernst Jan Plugge |
------------------------------------------------------------------------------ sp****@freenet.co.uk wrote: milkyway <d0******@hotmail.com> did eloquently scribble: Hello,
I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles and was wondering if there were any "makefile tools" out there. If so, what are the best ones?
autoconf, automake
Thats quite a big step. Also scons is very nice, and IMHO much easier for
small projects. Alternatively, just use a text editor to write your make
file. With implicit rules, you do not even have to list all your source
files.
Arne
--
[--- PGP key FD05BED7 --- http://www.root42.de/ ---]
"Arne Schmitz" <ar**********@gmx.net> wrote in message
news:3u************@news.dfncis.de... sp****@freenet.co.uk wrote: milkyway <d0******@hotmail.com> did eloquently scribble: I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles and was wondering if there were any "makefile tools" out there. If so, what are the best ones? autoconf, automake
Thats quite a big step.
Definitely.
Also scons is very nice, and IMHO much easier for small projects.
Looks interesting. Being written in Python is unfortunate in some respects.
Alternatively, just use a text editor to write your make file. With implicit rules, you do not even have to list all your source files.
Yes, you only need to list source files which #include any non-system header
files, which is normally all of them if there is more than one source file.
I suspect at least a basic understanding of how you would write a makefile
for a given project would be very useful for most, if not all, "makefile
tools".
Alex
On 2005-11-17, milkyway <d0******@hotmail.com> wrote: I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles
You don't create a makefile. You copy one and modify it.
Somebody once asked who created the first makefile, but there
was no first makefile -- it's just turtles all the way down...
--
Grant Edwards grante Yow! Look DEEP into the
at OPENINGS!! Do you see any
visi.com ELVES or EDSELS... or a
HIGHBALL??...
"milkyway" <d0******@hotmail.com> writes: Hello,
I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles and was wondering if there were any "makefile tools" out there. If so, what are the best ones?
Hmm, looks like some of the answers you've gotten are meant to
be humorous.
autoconf and friends are more complex than make.
I think you question is equivalent to asking for a tool to
write .bat files. Make is pretty simple,
using a tool to write make files is overkill unless you are
dealing with a really large project.
Spend a few minutes over at gnu.org reading the make documentation
or ask specific questions.
In article <dl**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com>,
Richard Heathfield <in*****@invalid.invalid> wrote: [Followups set to comp.lang.c]
milkyway said:
Hello,
I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles and was wondering if there were any "makefile tools" out there. If so, what are the best ones? If you don't want to get into autoconf etc, it's trivial to generate your own simple makefiles by writing a program in elementary ISO C. Here's a really, really simple one which you can hack to your heart's content.
<snippage>
printf("\t$(CC) $(CFLAGS) $(DFLAGS) -c -o %s.o %s.c\n", argv[i], argv[i]);
Posting a non-strictly-conforming program to comp.lang.c? What have
you done with The Real Richard Heathfield?
dave
(exercise for the reader: What's non-strictly-conforming about the code
I quoted?)
--
Dave Vandervies dj******@csclub.uwaterloo.ca
Note that non-portability of the translated code is not a requirement of
the C Standard.
--Richard Heathfield in comp.lang.c
Grant Edwards wrote: On 2005-11-17, milkyway <d0******@hotmail.com> wrote:
I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles
You don't create a makefile. You copy one and modify it.
Somebody once asked who created the first makefile, but there was no first makefile -- it's just turtles all the way down...
THE original:
%s/make/JCL/g
Wolfgang
Dave Vandervies said: In article <dl**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com>, Richard Heathfield <in*****@invalid.invalid> wrote:
printf("\t$(CC) $(CFLAGS) $(DFLAGS) -c -o %s.o %s.c\n", argv[i], argv[i]); Posting a non-strictly-conforming program to comp.lang.c? What have you done with The Real Richard Heathfield?
Er, eek.
(exercise for the reader: What's non-strictly-conforming about the code I quoted?)
I hear ya. Sorry, Dave - I was in helpful mode instead of picky guy mode.
I'll try not to let it happen again. :-)
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Alex Fraser wrote: Also scons is very nice, and IMHO much easier for small projects.
Looks interesting. Being written in Python is unfortunate in some respects.
Why so?
Arne
--
[--- PGP key FD05BED7 --- http://www.root42.de/ ---]
"Dave Vandervies" <dj******@csclub.uwaterloo.ca> wrote in message
news:dl**********@rumours.uwaterloo.ca... In article <dl**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com>, Richard Heathfield <in*****@invalid.invalid> wrote:
<snippage>
printf("\t$(CC) $(CFLAGS) $(DFLAGS) -c -o %s.o %s.c\n", argv[i], argv[i]);
Posting a non-strictly-conforming program to comp.lang.c? What have you done with The Real Richard Heathfield?
dave (exercise for the reader: What's non-strictly-conforming about the code I quoted?)
I don't have my copy of standard handy, so this is just a guess:
No '$' character guaranteed in execution character set?
-Mike
Dave Vandervies a écrit : printf("\t$(CC) $(CFLAGS) $(DFLAGS) -c -o %s.o %s.c\n", argv[i], argv[i]);
(exercise for the reader: What's non-strictly-conforming about the code I quoted?)
Too easy. '$' is not part of the standard charset.
--
A+
Emmanuel Delahaye
In article <dl**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com>,
Richard Heathfield <in*****@invalid.invalid> wrote: Dave Vandervies said:
Posting a non-strictly-conforming program to comp.lang.c? What have you done with The Real Richard Heathfield?
I hear ya. Sorry, Dave - I was in helpful mode instead of picky guy mode. I'll try not to let it happen again. :-)
It's the "instead of" that I'm worried about. Who says you can't do both?
dave
(helpful is good, nitpicky is better, helpful AND nitpicky is best of all.
Unless it's homework questions.)
--
Dave Vandervies dj******@csclub.uwaterloo.ca
Normally if something is simple enough that anyone should be able to put their
brain in gear and do it, you'd say "It's not rocket science!" but of course in
this case it is. --Anthony de Boer in the scary devil monastery
"milkyway" <d0******@hotmail.com> wrote I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles and was wondering if there were any "makefile tools" out there. If so, what are the best ones?
make is already a tool to make programs.
Once you need a tool to make a makefile, you've reached the end of make's
usefulness, and it's time to look for something else.
"Malcolm" <re*******@btinternet.com> writes: "milkyway" <d0******@hotmail.com> wrote I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles and was wondering if there were any "makefile tools" out there. If so, what are the best ones? make is already a tool to make programs. Once you need a tool to make a makefile, you've reached the end of make's usefulness, and it's time to look for something else.
Actually, tools that generate Makefiles are fairly common.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
"Keith Thompson" <ks***@mib.org> wrote Actually, tools that generate Makefiles are fairly common.
And you need the horrible things to make emacs debug / error edit properly.
I'm a gcc *.c man myself.
Emmanuel Delahaye wrote: Dave Vandervies a écrit :
printf("\t$(CC) $(CFLAGS) $(DFLAGS) -c -o %s.o %s.c\n", argv[i], argv[i]);
(exercise for the reader: What's non-strictly-conforming about the code I quoted?)
Too easy. '$' is not part of the standard charset.
4#5 "A strictly conforming program shall use only those features of the
language and library specified in this International Standard. It shall
not produce output dependent on any unspecified, undefined, or
implementation-defined behavior, and shall not exceed any minimum
implementation limit.
5.2.1#1 "The values of the members of the execution character set are
implementation-defined."
6.4.5#5"The value of a string literal containing a multibyte character
or escape sequence not represented in the execution character set is
implementation-defined."
What if we use universal character names?
printf("\t\u0024(CC) \u0024(CFLAGS) \u0024(DFLAGS) -c -o %s.o %s.c\n",
argv[i], argv[i]);
Unfortunately, it is still implementation-defined whether \u0024 is a
member of the execution character set, so this program cannot be
considered strictly conforming.
--
Simon.
Emmanuel Delahaye <em***@YOURBRAnoos.fr> writes: Dave Vandervies a écrit : printf("\t$(CC) $(CFLAGS) $(DFLAGS) -c -o %s.o %s.c\n", argv[i], argv[i]);
(exercise for the reader: What's non-strictly-conforming about the code I quoted?)
Too easy. '$' is not part of the standard charset.
Of course, we've never had a rule against posting
non-strictly-conforming code here. If we did, we couldn't post
#include <stdio.h>
int main(void)
{
printf("sizeof(int) = %d\n", (int)sizeof(int));
return 0;
}
(Yeah, I know, I'm spoiling the joke.)
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Melvin |
last post by:
Hello all,
I just want to throw this out here as an idea I have and wanted some input
and/or direction.
I am currently working as a software developer and we have run into an issue
with our...
|
by: Janne Naukkarinen |
last post by:
Have someone commercial Digital
Mars (DMC) IDDE?
I need help making makefiles, it is
easier with IDDE.
However, IDDE is not freely distributed on net.
There is current WinVN WIP:
|
by: djake |
last post by:
Someone can explain me what are makefiles useful for? Couldn't i write
shell script instead of makefiles? (*.sh in unix; *.cmd in win32)
Moreover i really doesn't understand what dependencies are...
|
by: markus |
last post by:
Hi,
As I been programming in C I have discovered more and more tools that
really helps to speed up the development process when writing
programs. Examples of such tools are cscope, cbrowser,...
|
by: Paminu |
last post by:
I have the following three files:
link.h
contains my structs and list of functions.
link.c
contains my implementation of the functions
linktest.c
contains my main function that test the...
|
by: Johs |
last post by:
I have a source file called project.c. In the same folder I have a
Makefile containing:
CC=gcc
CFLAGS=-g
project: project.c
$(CC) $(CFLAGS) project.c -o project
|
by: chris.love |
last post by:
I'm trying to port a project from Linux to Windows. Currently on Linux
we're using GNU Make and... of course... makefiles.
Does anything exist out there to convert makefiles to vcproj files, or...
|
by: chandan agarwal |
last post by:
hi
I have been given the task of building vc++ programs at the command line using make software.
i have installed gnu make-3.81 version. i was able to build and run makefiles for turbo c++. but...
|
by: tvnaidu |
last post by:
porting windows static libs and dll into linux static lib abd shared lib, any tool to convert vcproj files to Linux makefiles?
porting windows static libs and dll into linux static lib abd shared...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |