LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-02-2005, 07:26 AM   #1
Hanj
LQ Newbie
 
Registered: Mar 2005
Location: Sweden
Distribution: Ubuntu 5.04
Posts: 15

Rep: Reputation: 0
Getting started with autoproject


I just came across the little utility "autoproject" which seems like a nice program for automatically generating all configure- and makefiles I need for a project. I have two questions though:
1. When I create a new project, autoproject generates one single source file. If I want my project to have more than one soure file, how do I add these to the project?
2. How can I make autoproject store my source files in a separate scr directory?
I can't find any info about this in the autoproject man pages. Any autoproject user out there who could help out? Or is there some better way to easily (I'm no good with makefiles and stuff) generate everything? What I want is basically some small tool that does what KDevelop or Anjuta does, i.e. generates configure and Makefile and updates when new files are added to the project, but I don't want an IDE.
 
Old 08-05-2005, 09:54 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
I'd not recommend autoproject.

It still uses the old autoconf format, and if you really want to use autoconf-connfigure scripts for a real project, you'll need to know about autoconf/automake anyways. So I think it's better to learn about autoconf/automake from scratch.

Read this thread to get started with the new version of autoconf/automake, and try to figure out how it works. The "recipe" I posted there assumes autoconf v2.57 or higher and automake version 1.7 or higher. Make sure you've got those installed.

When you followed that "recipe" with success, you can do the following to make the package to have a "src" directory:
  • Make a "src" directory:
    Code:
    shell$ mkdir src
  • Move the files "hello.c" and "Makefile.am" to the "src" directory:
    Code:
    shell$ mv hello.c Makefile.am src
  • Make a new "Makefile.am" in the top-level directory that just has one line to tell automake to process the "src" directory:
    Code:
    SUBDIRS = src
  • Edit "configure.ac" to read:
    Code:
    AC_INIT([Hello], [0.1], [you@example.com], [hello])
    AC_CONFIG_SRCDIR([src/hello.c])
    AM_INIT_AUTOMAKE
    AC_PROG_CC
    AC_PROG_INSTALL
    AC_CONFIG_FILES([Makefile src/Makefile])
    AC_OUTPUT
  • Rerun the autotools:
    Code:
    shell$ make maintainer-clean
    shell$ aclocal ; automake -a ; autoconf

To have automake process more .c source files, just edit "src/Makefile.am" and mention the other source files in the "hello_SOURCES ..." line. Like this:
Code:
bin_PROGRAMS = hello
hello_SOURCES = hello.c othersource.c yetanother.c
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Started mattp Linux - Laptop and Netbook 6 01-08-2005 11:51 PM
Getting started k06878 Linux - Newbie 12 11-19-2004 08:42 AM
Getting Started burningtheory Linux - Distributions 2 09-07-2004 03:32 PM
Help Getting started reddog64 Linux - Newbie 9 04-18-2004 10:45 PM
Getting started.... noclue_menew Linux - Newbie 31 10-03-2003 01:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration