LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-07-2004, 08:56 AM   #1
krumms
LQ Newbie
 
Registered: Feb 2004
Posts: 7

Rep: Reputation: 0
Angry Makefile.am - prog_CFLAGS are ignored?


I'm attempting to build a basic GTK+ application and am having a few difficulties with automake (Gentoo Linux, latest of pretty much everything.):

First, I run my bootstrap script:

Code:
tom@fee gpim $ cat bootstrap.sh
#!/bin/sh
 
aclocal
autoconf
automake -a --copy --gnu
./configure
tom@fee gpim $ cat configure.in
AC_INIT(src/main.c)
AM_INIT_AUTOMAKE(gpim, 1.0)
 
AC_PROG_CC
 
# TODO: check for gtk+ 2.x
 
AC_OUTPUT( Makefile src/Makefile )

tom@fee gpim $ ./bootstrap.sh
creating cache ./config.cache
checking for a BSD compatible install... /bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal-1.4... found
checking for working autoconf... found
checking for working automake-1.4... found
checking for working autoheader... found
checking for working makeinfo... found
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating src/Makefile
So far so good. Now, make:

Code:
tom@fee gpim $ cat Makefile.am
SUBDIRS=src

tom@fee gpim $ cat src/Makefile.am
bin_PROGRAMS=gpim
gpim_SOURCES=main.c gpim_contact.c gpim_contactlistio.c
gpim_CFLAGS=-Wall -I../include `pkg-config gtk+-2.0 --cflags`
gpim_LDFLAGS=`pkg-config gtk+-2.0 --libs` -lexpat

tom@fee gpim $ make
Making all in src
make[1]: Entering directory `/home/tom/work.d/software/gpim/src'
gcc -DPACKAGE=\"gpim\" -DVERSION=\"1.0\"  -I. -I.      -g -O2 -c main.c
main.c:1:21: gtk/gtk.h: No such file or directory
main.c:3: error: syntax error before '*' token
main.c: In function `main':
main.c:8: error: `GtkWidget' undeclared (first use in this function)
main.c:8: error: (Each undeclared identifier is reported only once
main.c:8: error: for each function it appears in.)
main.c:8: error: `main_wnd' undeclared (first use in this function)
main.c:13: error: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)
main.c:14: error: `NULL' undeclared (first use in this function)
make[1]: *** [main.o] Error 1
make[1]: Leaving directory `/home/tom/work.d/software/gpim/src'
make: *** [all-recursive] Error 1
Here two problems are evident:

- my CFLAGS are not being passed to the compiler ...
- ... and as a result gtk/gtk.h cannot be found

Does anybody know what might be going on? Weird thing is, if I use INCLUDE instead of gpim_CFLAGS, it works (even gpim_LDFLAGS is passed to the linker).

What am I doing wrong?
 
Old 02-24-2004, 01:49 AM   #2
jasonar79
LQ Newbie
 
Registered: Feb 2004
Location: Chicago
Distribution: fedora core 1
Posts: 11

Rep: Reputation: 0
Why are you using the kbuild makefile syntax instead of good old straightforward makefile syntax??? You shouldn't need to use a syntax like this unless you are building something to be linked into the kernel.

-Jason Arnold
 
Old 02-24-2004, 08:37 AM   #3
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
He's using a Makefile.am file, which is converted to a Makefile by the confgure script created with autoconf.

My suggestion would be to examine the resulting Makefile and see if you can figure out what's going wrong. I've only just started learning the autobuild tools myself, but I don't see anything that might be wrong unless it is with problems expanding the stuff in the ` `...
 
  


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
How to modify makefile.in or makefile.am QiangWan Linux - Newbie 1 05-17-2005 11:07 AM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 03:57 AM
generate Makefile from Makefile.in without calling ./configure ? chris78 Programming 2 05-02-2004 12:23 PM
Makefile help varala_kanth Linux - Software 2 03-17-2004 04:00 AM
Makefile.am/Makefile.in DOA Linux - Newbie 5 01-20-2004 07:35 PM

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

All times are GMT -5. The time now is 07:30 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