Message: Re: GNUmakefile for subdirectories? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: GNUmakefile for subdirectories? 

Keywords: GNUmakefile make sub-directories
Forum: Installation and Configuration
Re: Question GNUmakefile for subdirectories? (Kareem Kazkaz)
Re: None Re: GNUmakefile for subdirectories? (Kareem Kazkaz)
Date: 05 Jan, 2008
From: John Allison <John Allison>

This problem has been solved offline. Here is a summary.

It is an excellent idea to break a project into submodules.  If A, B,.. are libraries:
  A/GNUmakefile 
  A/include/a1.hh, a2.hh,...
  A/src/a1.cc, a2.cc,...
and X. Y,... are applications containing a main program in X.cc:
  X/GNUmakefile 
  X/X.cc
  X/include/x1.hh, x2.hh,...
  X/src/x1.cc, x2.cc,...
then suitable GNUmakefiles look something like the following.  Note that as things stand, there must be
at least one .cc file in X/src/, but it can be empty.

A/GNUmakefile:
  name := A
  include $(G4INSTALL)/config/architecture.gmk
  include $(G4INSTALL)/config/common.gmk
  CPPFLAGS += -I$(G4INSTALL)/include
  # An if required
  CPPFLAGS += -I../B/include

X/GNUmakefile:
  name := X
  G4TARGET := $(name)
  G4EXLIB := true
  .PHONY: all
  all: lib bin
  include $(G4INSTALL)/config/architecture.gmk
  CPPFLAGS += -I../A/include
  EXTRALIBS += -lA
  CPPFLAGS += -I../B/include
  EXTRALIBS += -lB
  include $(G4INSTALL)/config/binmake.gmk

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "Re: GNUmakefile for subdirectories?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]