# Makefile # # Makefile for tooltips system. # # Copyright (C) 1997 Michael Chu # This file is part of the tooltips system for XForms. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # Contact information: Michael Chu # mmchu@pobox.com # Version number. VERSION = 0.02g # Define where the XForms include files are. XFORMS_INCLUDE_DIR = /usr/local/xforms/FORMS # Define where the X11 include files are. X11_INCLUDE_DIR = /usr/X11R6/include/X11 # Define other include file directories. OTHER_INCLUDE_DIR = /usr/X11R6/include # Uncomment out this line if you do not want debug information included. # DEBUG = -g -Wall -ansi -pedantic DEBUG = # Define the utilities to use for compilation. CC = gcc CCOPTS = $(DEBUG) -I$(XFORMS_INCLUDE_DIR) -I$(X11_INCLUDE_DIR) \ -I$(OTHER_INCLUDE_DIR) AR = ar AROPTS = rc SED = sed SEDOPTS = -e RM = rm RMOPTS = -rf ECHO = echo ECHOOPTS = TAR = tar TAROPTS = GZIP = gzip GZIPOPTS = -9 MKDIR = mkdir MKDIROPTS = CP = cp CPOPTS = CHMOD = chmod CHMODOPTS = -R +rw CD = cd CDOPTS = RANLIB = ranlib RANLIBOPTS = LN = ln LNOPTS = -s ########################################################################### all: libtooltips.a libtooltips.a: tooltips.o tooltips_forms.o @$(ECHO) $(ECHOOPTS) Removing old library if it exists... @$(RM) $(RMOPTS) libtooltips.a @$(ECHO) $(ECHOOPTS) Creating new library from object files... @$(AR) $(AROPTS) libtooltips.a tooltips.o tooltips_forms.o @$(RANLIB) $(RANLIBOPTS) libtooltips.a tooltips.o: tooltips.c tooltips.h tooltips_forms.h @$(ECHO) $(ECHOOPTS) Compiling tooltips.o from tooltips.c... @$(CC) $(CCOPTS) -c tooltips.c tooltips_forms.o: tooltips_forms.fixed.c tooltips_forms.h @$(ECHO) $(ECHOOPTS) Compiling tooltips_forms.o from tooltips_forms.fixed.c... @$(CC) $(CCOPTS) -c tooltips_forms.fixed.c -o tooltips_forms.o # The purpose for this fix is to change: # FD_ToolTip *fdui = (FD_ToolTip *) fl_calloc(1, sizeof(*fdui)); # # to # # FD_ToolTip *fdui = (FD_ToolTip *) fl_calloc(1, sizeof(FD_ToolTip)); # # This is because *fdui before fdui is initialized is a dangerous operation. # The fixed version is the equivalent but safer. tooltips_forms.fixed.c: tooltips_forms.c @$(ECHO) $(ECHOOPTS) Fixing tooltips_forms.c... @$(SED) $(SEDOPTS) 's/\(.*\) \*fdui = (\1 \*) fl_calloc(1, sizeof(\*fdui));/\1 \*fdui = (\1 \*) fl_calloc(1, sizeof(\1));/' tooltips_forms.c > tooltips_forms.fixed.c clean: @$(ECHO) $(ECHOOPTS) Removing all old object files and libraries... @$(RM) $(RMOPTS) *~ *.o *.a @$(ECHO) $(ECHOOPTS) Removing fixed tooltips_forms.c file... @$(RM) $(RMOPTS) tooltips_forms.fixed.c dist: Makefile COPYING tooltips.c tooltips.h tooltips_forms.c dist: tooltips_forms.h tooltips_forms.fd @$(ECHO) $(ECHOOPTS) Removing previous distribution/work files... @$(RM) $(RMOPTS) tooltips-$(VERSION).tar tooltips-$(VERSION).tar.gz @$(RM) $(RMOPTS) tooltips-$(VERSION) @$(ECHO) $(ECHOOPTS) Creating distribution file... @$(MKDIR) $(MKDIROPTS) tooltips-$(VERSION) @$(CP) $(CPOPTS) Makefile CHANGES COPYING README THANKS TODO \ tooltips.c tooltips.h \ tooltips_forms.c tooltips_forms.h tooltips_forms.fd \ tooltips-$(VERSION) @$(MKDIR) $(MKDIROPTS) tooltips-$(VERSION)/examples @$(MKDIR) $(MKDIROPTS) tooltips-$(VERSION)/examples/menu @$(CP) $(CPOPTS) examples/menu/Makefile examples/menu/menu.c \ examples/menu/menu_forms.c examples/menu/menu_forms.fd \ examples/menu/menu_forms.h \ tooltips-$(VERSION)/examples/menu @$(CHMOD) $(CHMODOPTS) tooltips-$(VERSION) @$(LN) $(LNOPTS) tooltips-$(VERSION) tooltips @$(TAR) $(TAROPTS) cf tooltips-$(VERSION).tar tooltips-$(VERSION) \ tooltips @$(ECHO) $(ECHOOPTS) Compressing distribution file... @$(GZIP) $(GZIPOPTS) tooltips-$(VERSION).tar @$(ECHO) $(ECHOOPTS) Removing work files... @$(RM) $(RMOPTS) tooltips-$(VERSION) tooltips \ tooltips-$(VERSION)-work.tar