# Unix Makefile for XGlk library # Based on the original by Andrew Plotkin. Modified to create a shared # library by Joe Mason. # XGlk 0.4.11 MAJOR=0 MINOR=4 MICRO=11 # This generates two files. One, of course, is libxglk.a -- the library # itself. The other is Make.xglk; this is a snippet of Makefile code # which locates the xglk library and associated libraries (such as # curses.) # # When you install xglk, you must put libxglk.a in the lib directory, # and glk.h, glkstart.h, and Make.xglk in the include directory. GLKNAME = xglk GLKINCLUDEDIR = /usr/local/include/glk GLKLIBDIR = /usr/local/lib/ # If you get errors in xio.c about fd_set or FD_SET being # undefined, put "-DNEEDS_SELECT_H" in the SYSTEMFLAGS line, # as has been done for the RS6000. # -------------------- # definitions for RS6000 / AIX #SYSTEMFLAGS = -DNEEDS_SELECT_H # definitions for HP / HPUX #SYSTEMFLAGS = -Ae # definitions for HP / HPUX 9.0 # (Dunno; this was contributed to me) #SYSTEMFLAGS = -Aa -D_HPUX_SOURCE # definitions for SparcStation / SunOS #SYSTEMFLAGS = # definitions for SparcStation / Solaris # (Solaris 2.5, don't know about other versions) #SYSTEMLIBS = -R$(XLIB) -lsocket # definitions for DECstation / Ultrix #SYSTEMFLAGS = # definitions for SGI / Irix #SYSTEMFLAGS = # definitions for Linux SYSTEMFLAGS = -D_BSD_SOURCE # -------------------- # definitions for where the X lib and include directories are. # The following are defaults that might work. # If your compiler can't find these things, try commenting out the # above, and uncommenting various versions below. Also look around # your hard drive for the appropriate files. (The XINCLUDE directory # should contain the file "Xlib.h", and the XLIB dir should contain # "libX11.so" or "libX11.a".) # The problem is, depending on how things are installed, the # directories could be just about anywhere. Sigh. # for Debian Linux XINCLUDE = -I/usr/X11R6/include/X11 XLIB = -L/usr/X11R6/lib -lX11 # for Red Hat Linux #XINCLUDE = -I/usr/X11R6/include/X11 #XLIB = -L/usr/X11R6/lib -lX11 # for SparcStation / Solaris #XINCLUDE = -I/usr/openwin/include #XLIB = -R/usr/openwin/lib -L/usr/openwin/lib/ -lX11 # -------------------- # definitions for where the PNG and JPEG libs are. PNGINCLUDE = PNGLIB = -lpng JPEGINCLUDE = JPEGLIB = -ljpeg # If there is no PNG lib available, uncomment this line. # PNGFLAG = -DNO_PNG_AVAILABLE # If there is no JPEG lib available, uncomment this line. # JPEGFLAG = -DNO_JPEG_AVAILABLE # definitions for the MikMod library. SDLINCLUDE = $(shell sdl-config --cflags) SDLCFLAGS = $(shell sdl-config --cflags) SDLLIB = $(shell sdl-config --libs) -lSDL_mixer # -------------------- # Pick a C compiler. #CC = cc CC = gcc LINK = gcc INSTALL = install -g 0 -o 0 CFLAGS += -fPIC -ansi $(PNGFLAG) $(JPEGFLAG) $(PNGINCLUDE) $(SDLINCLUDE) $(JPEGINCLUDE) -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-unused -Wbad-function-cast $(SYSTEMFLAGS) $(XINCLUDE) LIBS = $(XLIB) $(PNGLIB) $(JPEGLIB) $(SDLLIB) $(SYSTEMLIBS) GLKLIBSTATIC = lib$(GLKNAME).a GLKLIBSHARED = lib$(GLKNAME).so GLKMAKEFILE = Make.$(GLKNAME) OBJS = main.o xglk.o xglk_vars.o xglk_prefs.o xglk_loop.o xglk_init.o \ xglk_scrap.o xglk_msg.o xglk_key.o xglk_weggie.o xglk_pict.o \ xglk_res.o \ xg_event.o xg_window.o xg_stream.o xg_fileref.o xg_style.o xg_misc.o \ xg_gestalt.o xg_win_textbuf.o xg_win_textgrid.o xg_win_graphics.o \ xg_schan.o \ gi_dispa.o gi_blorb.o all: $(GLKLIBSTATIC) $(GLKLIBSHARED) $(GLKMAKEFILE) $(GLKLIBSTATIC): $(OBJS) ar r $(GLKLIBSTATIC) $(OBJS) ranlib $(GLKLIBSTATIC) $(GLKLIBSHARED): $(OBJS) $(LINK) $(LDFLAGS) -shared -Wl,-soname,$(GLKLIBSHARED).$(MAJOR) -o $(GLKLIBSHARED).$(MAJOR).$(MINOR).$(MICRO) $(OBJS) $(LIBDIRS) $(LIBS) $(GLKMAKEFILE): echo LINKLIBS = $(LIBDIRS) $(LIBS) > $(GLKMAKEFILE) echo GLKLIB = -l$(GLKNAME) >> $(GLKMAKEFILE) $(OBJS): xglk.h xg_internal.h xglk_option.h glk.h gi_dispa.h gi_blorb.h xg_win_textgrid.o xg_window.o xglk_key.o: xg_win_textgrid.h xg_win_textbuf.o xg_window.o xglk_key.o: xg_win_textbuf.h install: $(INSTALL) -m 2775 -d $(GLKINCLUDEDIR) $(INSTALL) -m 0644 $(GLKMAKEFILE) $(GLKINCLUDEDIR) $(INSTALL) -m 2775 -d $(GLKLIBDIR) $(INSTALL) -m 0644 $(GLKLIBSTATIC) $(GLKLIBDIR) $(INSTALL) -m 0755 $(GLKLIBSHARED).$(MAJOR).$(MINOR).$(MICRO) $(GLKLIBDIR) ln -s -f $(GLKLIBDIR)/$(GLKLIBSHARED).$(MAJOR).$(MINOR).$(MICRO) $(GLKLIBDIR)/$(GLKLIBSHARED).$(MAJOR).$(MINOR) ln -s -f $(GLKLIBDIR)/$(GLKLIBSHARED).$(MAJOR).$(MINOR).$(MICRO) $(GLKLIBDIR)/$(GLKLIBSHARED).$(MAJOR) ln -s -f $(GLKLIBDIR)/$(GLKLIBSHARED).$(MAJOR).$(MINOR).$(MICRO) $(GLKLIBDIR)/$(GLKLIBSHARED) uninstall: rm -f $(GLKINCLUDEDIR)/$(GLKMAKEFILE) rmdir -p --ignore-fail-on-non-empty $(GLKINCLUDEDIR) rm -f $(GLKLIBDIR)/$(GLKLIBSTATIC) rm -f $(GLKLIBDIR)/$(GLKLIBSHARED) rm -f $(GLKLIBDIR)/$(GLKLIBSHARED).$(MAJOR) rm -f $(GLKLIBDIR)/$(GLKLIBSHARED).$(MAJOR).$(MINOR) rm -f $(GLKLIBDIR)/$(GLKLIBSHARED).$(MAJOR).$(MINOR).$(MICRO) rmdir -p --ignore-fail-on-non-empty $(GLKLIBDIR) clean: rm -f *~ *.o $(GLKLIBSTATIC) $(GLKLIBSHARED).$(MAJOR).$(MINOR).$(MICRO) $(GLKMAKEFILE)