Appendix F Using the GNUstep Make Package

Reference/doc on the GNUstep make package; mainly examples of various types of projects.

F.1 Makefile Contents

Note. Type man make for assistance.

Make files comprise four key content types:

F.1.1 Makefile Example

# The following two lines force the standard make to recognize the 
# Objective-C .m suffix.

.SUFFIXES: .o .m
.m.o:
$(CC) -c $(CFLAGS) $< 


# Macro declarations

CC = gcc
CFLAGS = -g
LIBS = -lobjc
SRC=main.m Truck.m Station.m Vehicle.m
OBJ=main.o Truck.o Station.o Vehicle.o


# Explicit rules

hist: $(OBJ)
	$(CC) $(CFLAGS) -o main $(OBJ) $(LIBS)


# Implicit rules

Truck.o: Truck.h Truck.m
Station.o: Truck.h Station.h Station.m
Vehicle.o: Truck.h Vehicle.h Vehicle.m
main.o: Station.h Vehicle.h

F.1.2 Makefile Structure

The following Makefile defines a project:

#
# A GNUmakefile
#

# Check that the GNUSTEP_MAKEFILES environment variable is set
ifeq ($(GNUSTEP_MAKEFILES),)
GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
 ifeq ($(GNUSTEP_MAKEFILES),)
   $(error You need to set GNUSTEP_MAKEFILES before compiling!)
 endif
endif

# Include the common variables
include $(GNUSTEP_MAKEFILES)/common.make

# Build an Objective-C program
OBJC_PROGRAM_NAME = simple

# Objective-C files requiring compilation
simple_OBJC_FILES = source.m

-include GNUmakefile.preamble

# Include in the rules for making Objective-C programs
include $(GNUSTEP_MAKEFILES)/objc.make

-include GNUmakefile.postamble

To compile a package that uses the Makefile Package, type make in the top-level directory of the package. A non-GNUstep Objective-C file may be compiled by adding -lobjc on at the command line.

F.1.3 Debug and Profile Information

By default the Makefile Package does not flag the compiler to generate debugging information that is generated by typing:

make debug=yes

This command also causes the Makefile Package to turn off optimization. It is therefore necessary to override the optimization flag when running Make if both debugging information and optimization is required. Use the variable OPTFLAG to override the optimization flag.

By default the Makefile Package does not instruct the compiler to create profiling information that is generated by typing:

make profile=yes


F.1.4 Static, Shared and DLLs

By default the Makefile Package generates a shared library if it is building a library project type, and it will link with shared libraries if it is building an application or command-line tool project type. To tell the Makefile Package not to build using shared libraries but using static libraries instead, type:

make shared=no

This default is only applicable on systems that support shared libraries; systems that do not support shared libraries will always build using static libraries. Some systems support DLLs that are a form of shared libraries; on these systems DLLs are built by default unless the Makefile Package is told to build using static libraries instead.

F.2 Project Types

Projects are divided into different types. To create a project of a specific type, a make file is specified:

include $(GNUSTEP_MAKEFILES)/application.make

Each project type is independent, and if you want to create two project types in the same directory (e.g. a tool and a Java program), include both the desired make files in your main Make file.

Concept Index

Jump to:   A   B   C   D   E   F   G   H   I   J   L   M   N   O   P   R   S   U   W   Y   Z  
Index EntrySection

A
abstract classObjective-C
advanced messagingAdvanced Messaging
allocating objectsObjects
AppKitIntroduction
ARCObjects
assertion facilitiesException Handling
assertion handling, compared with JavaException Handling
assertionsException Handling

B
base libraryBase Library
basic OO terminologyIntroduction
bundlesBundles and Frameworks
bycopy and byref type qualifiersDistributed Objects

C
categoriesClasses
class clusterObjective-C
class, abstractObjective-C
class, rootObjective-C
classesObjective-C
client/server processesDistributed Objects
cluster, classesObjective-C
compilation, conditionalCompliance to Standards

D
differences and similarities, Objective-C and C++Objective-C Java and C++
differences and similarities, Objective-C and JavaObjective-C Java and C++
directory layoutIntroduction
distributed objectsDistributed Objects
distributed objectsDistributed Objects
Distributed Objects Name Server, GNUstepDistributed Objects
distributed objects, client codeDistributed Objects
distributed objects, client codeDistributed Objects
distributed objects, error checkingDistributed Objects
distributed objects, example (no error checking)Distributed Objects
distributed objects, using a protocolDistributed Objects

E
error checking, distributed objectsDistributed Objects
exception facilitiesException Handling
exception handling, compared with JavaException Handling
exceptionsException Handling

F
filesystem layoutIntroduction
forward invocation, distributed objectsDistributed Objects
forwardingAdvanced Messaging
frameworksBundles and Frameworks

G
game server exampleDistributed Objects
gdomapDistributed Objects
GNUstep base libraryIntroduction
GNUstep Make packageMake
GNUstep make utilityIntroduction
GNUstep, what is?Introduction
graphical programmingIntroduction
gsdocGSDoc
GUIIntroduction

H
history of NeXTstepIntroduction
history of Objective-CIntroduction
history of OpenStepIntroduction

I
in, out, and inout type qualifiersDistributed Objects
inheritanceObjective-C
inheriting methodsObjective-C
instance variables, referring toObjective-C
interfaceClasses

J
Java and Guile, programming GNUstepJava and Guile

L
layout, filesystemIntroduction
loggingException Handling
logging facilitiesException Handling
logging, compared with JavaException Handling

M
Make package, GNUstepMake
make utility, GNUstepIntroduction
memory deallocationObjects
memory managementObjects
memory management, explicitObjects
memory management, OpenStep-styleObjects
memory management, retain countObjects
message forwarding, distributed objectsDistributed Objects
messagesObjective-C
messaging, advanced techniquesAdvanced Messaging

N
naming constraintsObjective-C
naming conventionsObjective-C
NeXTstep, historyIntroduction
NS_DURING macroException Handling
NS_ENDHANDLER macroException Handling
NS_HANDLER macroException Handling
NSAssert macroException Handling
NSAssertionHandler classException Handling
NSConnection classDistributed Objects
NSDebugLog functionException Handling
NSException classException Handling
NSLog functionException Handling
NSObjectObjective-C
NSProxy classDistributed Objects
NSRunLoop classDistributed Objects
NSUncaughtExceptionHandlerException Handling
NSWarnLog functionException Handling

O
ObjC-2 , automated reference countingObjects
object interaction, remote objectsDistributed Objects
object-oriented programmingIntroduction
Objective-C and C++, differences and similaritiesObjective-C Java and C++
Objective-C and Java, differences and similaritiesObjective-C Java and C++
Objective-C, historyIntroduction
Objective-C, what is?Introduction
objectsObjective-C
objects, initalizing and allocatingObjects
objects, working withObjects
oneway, type qualifierDistributed Objects
OpenStep complianceCompliance to Standards
OpenStep, historyIntroduction
OS X compatibilityCompliance to Standards
out, type qualifierDistributed Objects
overriding methodsObjective-C

P
polymorphismObjective-C
profiling facilitiesException Handling
protocol for distributed objectsDistributed Objects
protocol type qualifiersDistributed Objects
protocolsClasses
protocols, formalClasses

R
remote objectsDistributed Objects
resources, applicationBundles and Frameworks
root classObjective-C

S
standards complianceCompliance to Standards
standards, GNUstep compliance toCompliance to Standards
static typingObjective-C

U
user defaults, API complianceCompliance to Standards

W
what is GNUstep?Introduction
what is Objective-C?Introduction
working with objectsObjects
writing new classesClasses

Y
your first Objective-C programIntroduction

Z
ZonesObjects