ftp.nice.ch/Attic/openStep/implementation/gnustep/sources/objcX-0.87.tgz#/objcX-0.87/makefileConversions

README
 
README.rtf
[View README.rtf] 
app.make.diff
 
architecture
 
basicrules.make.diff
 
common.make.diff
 
makedepend
 
patchMakefiles
 
subproj.make.diff
 

README

NeXT-like makefiles using objcX

WHAT IS THIS ALL ABOUT?
  This folder contains some context diffs which, when patched with
NeXT's source makefiles, create similar makefiles which work at least
on Suns and possibly on other machines, using the objcX package
instead of NeXT's libraries.  This allows you to have your NeXT
projects compiling using objcX with just some minor changes to Project
Builder's makefiles, instead of having to write your own, which comes
in handy on big projects with subprojects and such.  Another benefit
is that your object files will be tucked away in a folder labeled with
the architecture of the machine on which they were compiled.  This
allows you to build your app on the NeXT and then on other machines
without the object files interfering with one another. 

HOW TO CREATE THE SOURCE MAKEFILES
  Instead of giving you the makefiles themselves, we are giving you diff
files which can be patched with NeXT's makefiles in order to create
the objcX makefiles.  We do this because the makefiles for objcX are
based upon the NeXT makefiles, so that it would be a violation of
copyright to distribute them to people who had not purchased NeXT's
development software. 

  If you run the script "patchMakefiles" on the NeXT, you will suddenly
have a directory called "MakefilesX" which will contain the files
app.make, basicrules.make, common.make and subproj.make.  If
patchMakefiles does not work, then you will have to do the patch
commands manually--if you look at patchMakefiles, it is fairly clear
what must be done.  In any case, you should take this "MakefilesX"
directory and put it wherever you want it, say in the top level of the
"objcX" directory.  In order to perform a make depends, you will also
have to take the "makedepend" script from your objcX directory and put
a copy of it in your "MakefilesX" directory. 

HOW TO CHANGE YOUR PROJECTS' MAKEFILES
  Now, whenever you make a program with Project Builder, you should make
a copy of the Makefile called "MakefileX" (the make will not work in
some cases if you use a different name) and you should make the
following changes to it.  In subproject Makefiles, only changes 1-3, 5
and 7 apply. 

1) Any resources that are something.nib should be something.xmib.
GLOBAL_RESOURCES = myProgram.nib
becomes
GLOBAL_RESOURCES = myProgram.xmib

2) Define OFILESWITHPATHS to be all of the object files that this
makefile will generate with "$(OFILE_DIR)/" in front of each.  So, you
must take all of the .m files from the CLASSES and MFILES macros and
all the .c files from the CFILES macro and change the suffix to .o,
and you also must make entries for each subproject, where
"foobar.subproj" becomes "foobar_subproj.o". 
OFILESWITHPATHS = $(OFILE_DIR)/myClass.o $(OFILE_DIR)/mySource.o\
		  $(OFILE_DIR)/myProgram_main.o $(OFILE_DIR)/mySubproject_subproj.o

3) In OTHERSRCS, change Makefile to MakefileX.
.preamble and .postamble. 
OTHERSRCS = Makefile.preamble Makefile Makefile.postamble
becomes
OTHERSRCS = MakefileX.preamble MakefileX MakefileX.postamble

4) Define OSTEPDIR as the path of your objcX directory.
OSTEPDIR = $(HOME)/objcX
(this step not necessary for subprojects)

5) Change the definition of MAKEFILEDIR to be the path of your
MakefilesX directory. 
MAKEFILEDIR = /NextDeveloper/Makefiles/app
becomes
MAKEFILEDIR = $(OSTEPDIR)/MakefilesX

6) Change the definition of LIBS so that you will compile with the
objcX libs and the Motif libs.  In the example below,
-L/usr/local/lib/X11R5 and -L/usr/lib tell the compiler where to look
for the Motif libraries, so how these flags should be set depends on
how your file system is organized. 
LIBS = -lMedia_s -lNeXT_s
becomes
LIBS = -lobjcX -lobjc -lcoll -L$(OSTEPDIR) -L/usr/local/lib/X11R5 \
		-L/usr/lib -lX11 -lm -lXm -lXmu -lXt -lXext
(this step not necessary for subprojects)

7) Define OTHER_CFLAGS to give the compiler the include paths for the
"objcX" directory and for the Motif include files.  Once again, you
the path for the Motif stuff is dependent on your local file system.
You may also add your own flags for the gcc compiler here if you like
(OTHER_CFLAGS is a macro that NeXT allows you to define in
"Makefile.preamble" for this purpose.) 
OTHER_CFLAGS = -I$(OSTEPDIR) -I/usr/local/X11R5/include
	
HOW TO COMPILE WITH THESE MAKEFILES
  In the NeXT project manager, you choose whether you want to build app,
debug, clean, profile, etc.  The same options apply here, but you
enter them in the command line.  So you would type 
	make app -f MakefileX
to build the .Xapp and to specify that MakefileX is the makefile that
should be used.  To build the debug version (.Xdebug) use
        make debug -f MakefileX

  These makefiles create a directory for your built app, called
yourProgram.Xapp, or .Xdebug or whatever, in the same way that the
NeXT puts it in a directory called yourProgram.app or .debug.  Inside
this directory will be the .xmib and the executable. 

OTHER NOTES
  NeXT's Project Builder is obviously not going to maintain your
MakefileX for you.  Therefore, every time you add or remove sources to
your project, you will have to look at the NeXT Makefile and make
corresponding changes to your MakefileX.

 In order to get everything to link correctly, these makefiles start
with the object files in the same directory as the source files, and
then move them into the appropriate directory.  The NeXT does not have
to do this.  Therefore, if a make fails, it will most likely leave
some object files laying around where you would not expect them.
Also, this means that doing a make on a NeXT and on a Sun at the same
time, for example,  will probably not work correctly, because the NeXT
may try to link with one of the Sun's object files. 

EXAMPLE
The following is a sample Makefile and a sample MakefileX

Makefile:
---------------------------------------------------------------------------
#
# Generated by the NeXT Project Builder.
#
# NOTE: Do NOT change this file -- Project Builder maintains it.
#
# Put all of your customizations in files called Makefile.preamble
# and Makefile.postamble (both optional), and Makefile will include them.
#

NAME = myProgram

PROJECTVERSION = 1.1
LANGUAGE = English

GLOBAL_RESOURCES = myProgram.nib

CLASSES = myClass.m

HFILES = myClass.h myMacros.h

MFILES = myProgram_main.m

CFILES = mySource.c

SUBPROJECTS = mySubproject.subproj

OTHERSRCS = Makefile.preamble Makefile Makefile.postamble m


MAKEFILEDIR = /NextDeveloper/Makefiles/app
MAKEFILE = app.make
INSTALLDIR = $(HOME)/Apps
INSTALLFLAGS = -c -s -m 755
SOURCEMODE = 444

ICONSECTIONS =	-sectcreate __ICON app /usr/lib/NextStep/Workspace.app/application.tiff

LIBS = -lMedia_s -lNeXT_s
DEBUG_LIBS = $(LIBS)
PROF_LIBS = $(LIBS)


-include Makefile.preamble

include $(MAKEFILEDIR)/$(MAKEFILE)

-include Makefile.postamble

-include Makefile.dependencies

---------------------------------------------------------------------------
MakefileX:

NAME = myProgram

PROJECTVERSION = 1.1
LANGUAGE = English

GLOBAL_RESOURCES = myProgram.xmib

CLASSES = myClass.m

HFILES = myClass.h myMacros.h

MFILES = myProgram_main.m

CFILES = mySource.c

SUBPROJECTS = mySubproject.subproj

OFILESWITHPATHS = $(OFILE_DIR)/myClass.o $(OFILE_DIR)/mySource.o\
		  $(OFILE_DIR)/myProgram_main.o $(OFILE_DIR)/mySubproject_subproj.o

OTHERSRCS = MakefileX.preamble Makefile MakefileX.postamble


OSTEPDIR = $(HOME)/objcX
TRNIB = $(OSTEPDIR)/nib-translator/trnib
MAKEFILEDIR = $(OSTEPDIR)/MakefilesX
MAKEFILE = app.make
INSTALLDIR = $(HOME)/Apps
INSTALLFLAGS = -c -s -m 755
SOURCEMODE = 444

ICONSECTIONS =	-sectcreate __ICON app /usr/lib/NextStep/Workspace.app/application.tiff

LIBS = -lobjcX -lobjc -lcoll -L$(OSTEPDIR) -L/usr/local/lib/X11R5 \
		-L/usr/lib -lX11 -lm -lXm -lXmu -lXt -lXext
DEBUG_LIBS = $(LIBS)
PROF_LIBS = $(LIBS)
OTHER_CFLAGS = -I$(OSTEPDIR) -I/usr/local/X11R5/include

-include MakefileX.preamble

include $(MAKEFILEDIR)/$(MAKEFILE)

-include MakefileX.postamble

-include MakefileX.dependencies

---------------------------------------------------------------------------

contributed by Jeff Kamerer (kamerer@crow.slac.stanford.edu)
updated by Mark Lakata(lakata@nsdssp.lbl.gov)

README.rtf

NeXT-like makefiles using objcX

WHAT IS THIS ALL ABOUT?
This folder contains some context diffs which, when patched with NeXT's source makefiles, create similar makefiles which work at least on Suns and possibly on other machines, using the objcX package instead of NeXT's libraries.  This allows you to have your NeXT projects compiling using objcX with just some minor changes to Project Builder's makefiles, instead of having to write your own, which comes in handy on big projects with subprojects and such.  Another benefit is that your object files will be tucked away in a folder labeled with the architecture of the machine on which they were compiled.  This allows you to build your app on the NeXT and then on other machines without the object files interfering with one another.

HOW TO CREATE THE SOURCE MAKEFILES
Instead of giving you the makefiles themselves, we are giving you diff files which can be patched with NeXT's makefiles in order to create the objcX makefiles.  We do this because the makefiles for objcX are based upon the NeXT makefiles, so that it would be a violation of copyright to distribute them to people who had not purchased NeXT's development software.

If you run the script "patchMakefiles" on the NeXT, you will suddenly have a directory called "MakefilesX" which will contain the files app.make, basicrules.make, common.make and subproj.make.  If patchMakefiles does not work, then you will have to do the patch commands manually--if you look at patchMakefiles, it is fairly clear what must be done.  In any case, you should take this "MakefilesX" directory and put it wherever you want it, say in the top level of the "objcX" directory.  In order to perform a make depends, you will also have to take the "makedepend" script from your objcX directory and put a copy of it in your "MakefilesX" directory.

HOW TO CHANGE YOUR PROJECTS' MAKEFILES
Now, whenever you make a program with Project Builder, you should make a copy
of the Makefile called "MakefileX" (the make will not work in some cases if you use a different name) and you should make the following changes to it.  In subproject Makefiles, only changes 1-3, 5 and 7 apply.

1) Any resources that are something.nib should be something.xmib.
GLOBAL_RESOURCES = myProgram.nib
becomes
GLOBAL_RESOURCES = myProgram.xmib

2) Define OFILESWITHPATHS to be all of the object files that this makefile will generate with "$(OFILE_DIR)/" in front of each.  So, you must take all of the .m files from the CLASSES and MFILES macros and all the .c files from the CFILES macro and change the suffix to .o, and you also must make entries for each subproject, where "foobar.subproj" becomes "foobar_subproj.o".
OFILESWITHPATHS = $(OFILE_DIR)/myClass.o $(OFILE_DIR)/mySource.o\
		  $(OFILE_DIR)/myProgram_main.o $(OFILE_DIR)/mySubproject_subproj.o

3) In OTHERSRCS, change Makefile to MakefileX and get rid of the .preamble and .postamble.
OTHERSRCS = Makefile.preamble Makefile Makefile.postamble
becomes
OTHERSRCS = MakefileX

4) Define OSTEPDIR as the path of your objcX directory.
OSTEPDIR = $(HOME)/objcX

5) Change the definition of MAKEFILEDIR to be the path of your MakefilesX directory.
MAKEFILEDIR = /NextDeveloper/Makefiles/app
becomes
MAKEFILEDIR = $(OSTEPDIR)/MakefilesX

6) Change the definition of LIBS so that you will compile with the objcX libs and the Motif libs.  In the example below, -L/usr/local/lib/X11R5 and -L/usr/lib tell the compiler where to look for the Motif libraries, so how these flags should be set depends on how your file system is organized.
LIBS = -lMedia_s -lNeXT_s
becomes
LIBS = -lobjcX -lobjc -lcoll -L$(OSTEPDIR) -L/usr/local/lib/X11R5 \
		-L/usr/lib -lX11 -lm -lXm -lXmu -lXt -lXext

7) Define OTHER_CFLAGS to give the compiler the include paths for the "objcX" directory and for the Motif include files.  Once again, you the path for the Motif stuff is dependent on your local file system.  You may also add your own flags for the gcc compiler here if you like (OTHER_CFLAGS is a macro that NeXT allows you to define in "Makefile.preamble" for this purpose.)
OTHER_CFLAGS = -I$(OSTEPDIR) -I/usr/local/X11R5/include
	
8) Remove the include commands that include "Makefile.preamble", "Makefile.postamble" and "Makefile.dependencies".  Only "$(MAKEFILEDIR)/$(MAKEFILE)"should be included.

HOW TO COMPILE WITH THESE MAKEFILES
In the NeXT project manager, you choose whether you want to build app, debug, clean, profile, etc.  The same options apply here, but you enter them in the command line.  So you would type
	make app -f MakefileX
to build the .Xapp and to specify that MakefileX is the makefile that should be used.

These makefiles create a directory for your built app, called yourProgram.Xapp, or .Xdebug or whatever, in the same way that the NeXT puts it in a directory called yourProgram.app or .debug.  Inside this directory will be the .xmib and the executable.

OTHER NOTES
NeXT's Project Builder is obviously not going to maintain your MakefileX for you.  Therefore, every time you add or remove sources to your project, you will have to look at the NeXT Makefile and make corresponding changes to your MakefileX.  The fact that your MakefileX is self-maintained also means that rather than putting your own special touches in Makefile.preamble and Makefile.postamble, you can put them in MakefileX.  You must put them before the line
	# DO NOT DELETE THIS LINE -- make depend depends on it.
if it exists, because everything after it is maintained by makedepend.  Makefile.preamble and Makefile.postamble give you many macros that you can define for different reasons; defining them in the MakefileX should give the desired effect.

In order to get everything to link correctly, these makefiles start with the object files in the same directory as the source files, and then move them into the appropriate directory.  The NeXT does not have to do this.  Therefore, if a make fails, it will most likely leave some object files laying around where you would not expect them.  Also, this means that doing a make on a NeXT and on a Sun at the same time, for example,  will probably not work correctly, because the NeXT may try to link with one of the Sun's object files.

EXAMPLE
The following is a sample Makefile and a sample MakefileX

Makefile:
#
# Generated by the NeXT Project Builder.
#
# NOTE: Do NOT change this file -- Project Builder maintains it.
#
# Put all of your customizations in files called Makefile.preamble
# and Makefile.postamble (both optional), and Makefile will include them.
#

NAME = myProgram

PROJECTVERSION = 1.1
LANGUAGE = English

GLOBAL_RESOURCES = myProgram.nib

CLASSES = myClass.m

HFILES = myClass.h myMacros.h

MFILES = myProgram_main.m

CFILES = mySource.c

SUBPROJECTS = mySubproject.subproj

OTHERSRCS = Makefile.preamble Makefile Makefile.postamble m


MAKEFILEDIR = /NextDeveloper/Makefiles/app
MAKEFILE = app.make
INSTALLDIR = $(HOME)/Apps
INSTALLFLAGS = -c -s -m 755
SOURCEMODE = 444

ICONSECTIONS =	-sectcreate __ICON app /usr/lib/NextStep/Workspace.app/application.tiff

LIBS = -lMedia_s -lNeXT_s
DEBUG_LIBS = $(LIBS)
PROF_LIBS = $(LIBS)


-include Makefile.preamble

include $(MAKEFILEDIR)/$(MAKEFILE)

-include Makefile.postamble

-include Makefile.dependencies

MakefileX:

NAME = myProgram

PROJECTVERSION = 1.1
LANGUAGE = English

GLOBAL_RESOURCES = myProgram.xmib

CLASSES = myClass.m

HFILES = myClass.h myMacros.h

MFILES = myProgram_main.m

CFILES = mySource.c

SUBPROJECTS = mySubproject.subproj

OFILESWITHPATHS = $(OFILE_DIR)/myClass.o $(OFILE_DIR)/mySource.o\
		  $(OFILE_DIR)/myProgram_main.o $(OFILE_DIR)/mySubproject_subproj.o

OTHERSRCS = MakefileX


OSTEPDIR = $(HOME)/objcX
MAKEFILEDIR = $(OSTEPDIR)/MakefilesX
MAKEFILE = app.make
INSTALLDIR = $(HOME)/Apps
INSTALLFLAGS = -c -s -m 755
SOURCEMODE = 444

ICONSECTIONS =	-sectcreate __ICON app /usr/lib/NextStep/Workspace.app/application.tiff

LIBS = -lobjcX -lobjc -lcoll -L$(OSTEPDIR) -L/usr/local/lib/X11R5 \
		-L/usr/lib -lX11 -lm -lXm -lXmu -lXt -lXext
DEBUG_LIBS = $(LIBS)
PROF_LIBS = $(LIBS)
OTHER_CFLAGS = -I$(OSTEPDIR) -I/usr/local/X11R5/include

include $(MAKEFILEDIR)/$(MAKEFILE)


contributed by Jeff Kamerer (kamerer@crow.slac.stanford.edu)

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.