Working with makefiles
While makefile content is generally the same in both Windows and UNIX environments, the process of creating and editing makefiles is different. The driver program source code includes makefiles that you can use as templates for creating your own makefiles.
Linux and UNIX
The following sample makefile for the driver program shows a typical set of flags in the Linux and UNIX environments.
# # This Makefile builds 'driver' as a 32-bit SPARC binary # for Solaris. # # # Parameters. PROGRAM = driver SOURCES = api.c get.c main.c print.c util.c OBJECTS = api.o get.o main.o print.o util.o LARCH = # Compiler flags. CC = cc CFLAGS = -g -DDEBUG -D_REENTRANT CPPFLAGS = -I../include -I../../include LDFLAGS = -L../lib -L../../lib LDLIBS = -lar$(LARCH) -lnsl -lw -lpthread -lcurses -ldl # Standard targets. all: $(PROGRAM) objects: $(OBJECTS) $(PROGRAM): $(OBJECTS) $(CC) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS) $(LDLIBS) clean: $(RM) $(PROGRAM) $(OBJECTS) core
See your system manual to find out if you must place library files in a specific order in the makefile. With Solaris, you must include the lpthread switch for the makefile line that starts with LDLIBS.
Creating and editing makefiles in the Windows environment is considerably simpler. The Microsoft Visual C++ compiler creates makefiles for you and provides a graphical interface for specifying the options that you want. You specify the appropriate makefile when you compile your program:
nmake /f filename.mak
The sample.mak file that comes with the driver program contains a sample makefile for Windows.