LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices

Reply
 
Search this Thread
Old 12-06-2007, 03:04 AM   #1
rushadrenaline
Member
 
Registered: Nov 2006
Location: Bangalore,New delhi
Distribution: RHEL5, Kubuntu, Mandriva 2008
Posts: 69

Rep: Reputation: 15
Question How to create a top level makefile


Hello everybody...
This is the directory structure of my Main folder, for which i need to write a top level makefile
$> ls /home/rah/MAIN
AF/
Middleware/
Platform/
Tools/-->toolchain_2.8.0/-->(bin/,include/,man/,lib/,usr/,share/,doc/,uclibc/)
Utils/

So the problem is that i need to write a top level makefile(which will reside in MAIN) and also i need to generate a ncurses based menu for compiling it.
All the Af,MW,platform,tools and utils directories have their makefiles ready.Now i need to write a top level makefile to link them all and also a ncurses based menu.
pls help me on this,its really urgent.
Thank you all
 
Old 12-07-2007, 03:34 PM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,037

Rep: Reputation: 756Reputation: 756Reputation: 756Reputation: 756Reputation: 756Reputation: 756Reputation: 756
For ncurses, you're on your own but here's what a top-level Makefile would look like:
Code:
MAKEFILE =      Makefile

#       Note: defined here, these will override local Makefile;
#       dont' define these unelss they're common to all subdirectories
CFLAGS  =       -O (or whatever you need)

#       Note: defined here, these will override local Makefile;
#       dont' define these unelss they're common to all subdirectories
LDFLAGS =       -lm (or whatever you need)

ALL:    build

build:
        @echo "Building system..."
        cd AF; make CFLAGS="$(CFLAGS)" LDFFLAGS="$(LDFFLAGS)"
        cd Middleware; make CFLAGS="$(CFLAGS)" LDFFLAGS="$(LDFFLAGS)"
        cd Platform; make CFLAGS="$(CFLAGS)" LDFFLAGS="$(LDFFLAGS)"
        cd Tools; make CFLAGS="$(CFLAGS)" LDFFLAGS="$(LDFFLAGS)"

install:
        @echo "Installing system..."
        cd AF; make CFLAGS="$(CFLAGS)" LDFFLAGS="$(LDFFLAGS)"
        cd Middleware; make CFLAGS="$(CFLAGS)" LDFFLAGS="$(LDFFLAGS)"
        cd Platform; make CFLAGS="$(CFLAGS)" LDFFLAGS="$(LDFFLAGS)"
        cd Tools; make CFLAGS="$(CFLAGS)" LDFFLAGS="$(LDFFLAGS)"

clean:
        @echo "Clean system..."
        cd AF; make clean
        cd Middleware; make clean
        cd Platform; make clean
        cd Tools; make clean
Now, if you do CFLAGS and LDFLAGS like this, they will override whatever is defined in a "local" Makefile; if you have different flags in you local Makefiles, don't define them in this Makefile and your "build" section would then look like
Code:
build:
        @echo "Building system..."
        cd AF; make
        cd Middleware; make
        cd Platform; make
        cd Tools; make
Hope this helps some, sorry that I can't write a ncurses for you but, you know, the command line works just fine, too.
 
Old 12-08-2007, 01:11 AM   #3
rushadrenaline
Member
 
Registered: Nov 2006
Location: Bangalore,New delhi
Distribution: RHEL5, Kubuntu, Mandriva 2008
Posts: 69

Original Poster
Rep: Reputation: 15
Thank you very much tronayne.
Ill check if it works fine, but that was a very decent and clean reply from your side.
Thanx again
 
Old 12-10-2007, 10:16 PM   #4
rushadrenaline
Member
 
Registered: Nov 2006
Location: Bangalore,New delhi
Distribution: RHEL5, Kubuntu, Mandriva 2008
Posts: 69

Original Poster
Rep: Reputation: 15
Hey guys this is what my dir structure looks like :

trav@localhost]$ ls ~/Main
AF/ Mware/ Platform/ Tools/ Utils/

The directory listing below, is an expansion of Mware.


[HTML]
MAIN/--
MWARE/--
Lib/
Miniapps/
Modules/--
dvdaudio/--
Makefile
dvdvideo/--
Makefile
gfxlibrary/--
Makefile
Keyboard/--
localkeyboard.c

remote/--
localremote.c
localremote.h

dvdaudioapi/--
include/
Makefile
dvdaudioapi.cpp
dvdaudioapi.d

dvdvideoapi/--
include/
Makefile
dvdvideoapi.cpp
dvdvideoapi.d

Obj/
Thirdparty/--
Applications/--

include/--
dvdlocal.h
dvdaudio.h
dvdtypes.h
vcdtypes.h
vcdaudio.h

Lib/--
librmdisc.so
librmdvdfs.so
librmdvdvideonav.so
librmvcdnav.so
Makefile
Modules/--
Module1/--
Application/--
include/--
src/--
Module2/--
Application/--
include/--
src/--
Module3/--
Application/--
include/--
src/--
Module4/--
Application/--
include/--
src/--
[/HTML]

dvdvideoapi.d file contains this code --(rmdvdvideoapi.o rmdvdvideoapi.d: Makefile rmdvdvideoapi.cpp rmdef.h rmdvdvideoapi.h\
rmdvdvideonav.h )

So the problem now is that i need to write a top level makefile that resides in Main/Mware/ and removes the .d (dependency) files and instead cretaes .so and .o files, while also taking care of the lower level makefiles.
Please ,help, im stuck again.
thanx

Last edited by rushadrenaline; 12-10-2007 at 11:31 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Top-Level Domain rewrite using mod_rewrite in Apache2 subcon Linux - Server 0 06-24-2007 11:33 PM
Running my own top level domain with BIND9 KneeLess Linux - Networking 4 03-26-2006 06:29 PM
Top Level Domain Names wwnexc Linux - Networking 3 03-12-2006 02:03 PM
DNS & Top Level Domain JJX Linux - Networking 2 03-28-2004 07:56 AM
FTP - setting top level dir donokono Linux - Networking 2 06-18-2002 06:17 PM


All times are GMT -5. The time now is 01:32 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration