1# Makefile for fixincludes. 2# 3# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004 4# Free Software Foundation, Inc. 5 6#This file is part of fixincludes. 7 8#fixincludes is free software; you can redistribute it and/or modify 9#it under the terms of the GNU General Public License as published by 10#the Free Software Foundation; either version 2, or (at your option) 11#any later version. 12 13#fixincludes is distributed in the hope that it will be useful, 14#but WITHOUT ANY WARRANTY; without even the implied warranty of 15#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16#GNU General Public License for more details. 17 18#You should have received a copy of the GNU General Public License 19#along with fixincludes; see the file COPYING. If not, write to 20#the Free Software Foundation, 51 Franklin Street, Fifth Floor, 21#Boston, MA 02110-1301, USA. 22 23SHELL=@SHELL@ 24 25# Some versions of `touch' (such as the version on Solaris 2.8) 26# do not correctly set the timestamp due to buggy versions of `utime' 27# in the kernel. So, we use `echo' instead. 28STAMP = echo timestamp > 29 30CC = @CC@ 31CFLAGS = @CFLAGS@ 32WARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANTIC@ @WERROR@ 33LDFLAGS = @LDFLAGS@ 34INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include 35FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES) 36 37# Directory where sources are, from where we are. 38srcdir = @srcdir@ 39VPATH = $(srcdir) 40 41# Directory in which to put the directories used by the compiler. 42libdir = @libdir@ 43# Directory in which GCC puts its executables. 44libexecdir = @libexecdir@ 45 46# End of variables for you to override. 47 48# The target that we're configured for. 49target = @target@ 50target_noncanonical:=@target_noncanonical@ 51 52# The version of GCC in this tree 53gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER) 54 55# Directory in which the compiler finds libraries etc. 56libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version) 57# Directory in which the compiler finds executables 58libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version) 59# Where our executable files go 60itoolsdir = $(libexecsubdir)/install-tools 61# Where our data files go 62itoolsdatadir = $(libsubdir)/install-tools 63 64# Locate mkinstalldirs. 65mkinstalldirs=$(SHELL) $(srcdir)/../mkinstalldirs 66 67default : all 68 69# Now figure out from those variables how to compile and link. 70 71.c.o: 72 $(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CFLAGS) $< 73 74# The only suffixes we want for implicit rules are .c and .o. 75.SUFFIXES: 76.SUFFIXES: .c .o 77 78# 79 80## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 81## 82## Makefile for constructing the "best" include fixer we can 83## 84## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 85 86LIBIBERTY=../libiberty/libiberty.a 87 88ALLOBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \ 89 fixlib.o fixopts.o 90 91TESTOBJ = fixincl.o fixlib.o fixtests.o fixopts.o 92FIXOBJ = fixfixes.o fixlib.o fixopts.o 93 94HDR = server.h fixlib.h 95FI = fixincl@EXEEXT@ 96AF = applyfix@EXEEXT@ 97 98all : @TARGET@ fixinc.sh mkheaders 99gen : $(srcdir)/fixincl.x 100 101 102oneprocess : full-stamp 103twoprocess : test-stamp $(AF) 104 105full-stamp : $(ALLOBJ) $(LIBIBERTY) 106 $(CC) $(CFLAGS) $(LDFLAGS) -o $(FI) $(ALLOBJ) $(LIBIBERTY) 107 $(STAMP) $@ 108 109test-stamp : $(TESTOBJ) $(LIBIBERTY) 110 $(CC) $(CFLAGS) $(LDFLAGS) -o $(FI) $(TESTOBJ) $(LIBIBERTY) 111 $(STAMP) $@ 112 113$(AF): $(FIXOBJ) $(LIBIBERTY) 114 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(FIXOBJ) $(LIBIBERTY) 115 116$(ALLOBJ) : $(HDR) 117fixincl.o : fixincl.c $(srcdir)/fixincl.x 118fixtests.o : fixtests.c 119fixfixes.o : fixfixes.c $(srcdir)/fixincl.x 120server.o : server.c 121procopen.o : procopen.c 122fixlib.o : fixlib.c 123 124fixinc.sh : fixinc.in mkfixinc.sh Makefile 125 srcdir="$(srcdir)" $(SHELL) $(srcdir)/mkfixinc.sh $(target) 126 127$(srcdir)/fixincl.x: @MAINT@ fixincl.tpl inclhack.def 128 cd $(srcdir) ; $(SHELL) ./genfixes 129 130mostlyclean : 131 rm -f *.o *-stamp $(AF) $(FI) *~ fixinc.sh 132 133clean: mostlyclean 134 rm -f mkheaders mkheaders.almost 135 136distclean: clean 137 rm -f Makefile config.h config.log config.status stamp-h 138 139maintainer-clean: distclean 140 rm -f $(srcdir)/fixincl.x 141 142distclean : clean 143 144Makefile: $(srcdir)/Makefile.in config.status 145 $(SHELL) ./config.status Makefile 146 147mkheaders.almost: $(srcdir)/mkheaders.in config.status 148 CONFIG_FILES=mkheaders.almost:mkheaders.in \ 149 CONFIG_HEADERS= ./config.status 150 151mkheaders: mkheaders.almost $(srcdir)/../gcc/BASE-VER 152 sed -e 's/@gcc_version@/$(gcc_version)/' < $< > $@T 153 mv -f $@T $@ 154 155config.h: stamp-h 156stamp-h: $(srcdir)/config.h.in config.status 157 $(SHELL) ./config.status config.h 158 159config.status: $(srcdir)/configure 160 $(SHELL) ./config.status --recheck 161 162$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac 163 cd $(srcdir) && autoconf 164 165$(srcdir)/config.h.in: @MAINT@ $(srcdir)/configure.ac 166 cd $(srcdir) && autoheader 167 168$(srcdir)/aclocal.m4: @MAINT@ $(srcdir)/../gcc/aclocal.m4 169 cp $(srcdir)/../gcc/aclocal.m4 . 170 171check : all 172 autogen -T $(srcdir)/check.tpl $(srcdir)/inclhack.def 173 $(SHELL) ./check.sh $(srcdir)/tests/base 174 @rm -f ./check.sh 175 176install : all 177 -rm -rf $(DESTDIR)$(itoolsdir) 178 $(mkinstalldirs) $(DESTDIR)$(itoolsdir) 179 $(mkinstalldirs) $(DESTDIR)$(itoolsdatadir)/include 180 $(INSTALL_DATA) $(srcdir)/README-fixinc \ 181 $(DESTDIR)$(itoolsdatadir)/include/README 182 $(INSTALL_SCRIPT) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh 183 $(INSTALL_PROGRAM) fixincl@EXEEXT@ \ 184 $(DESTDIR)$(itoolsdir)/fixincl@EXEEXT@ 185 $(INSTALL_SCRIPT) mkheaders $(DESTDIR)$(itoolsdir)/mkheaders 186 187.PHONY: dvi info html install-html 188 189dvi : 190pdf : 191info : 192html : 193install-html : 194installcheck : 195