Makefile.in 5.58 KB
Newer Older
1
# Makefile for fixincludes.
Bruce Korb committed
2
#
3
#   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2009, 2010, 2012
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 3, or (at your option)
11 12
#any later version.

13
#fixincludes is distributed in the hope that it will be useful,
14 15 16 17 18
#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
19 20
#along with fixincludes; see the file COPYING3.  If not see
#<http://www.gnu.org/licenses/>.
21

22
SHELL=@SHELL@
23

24 25 26 27 28
# Some versions of `touch' (such as the version on Solaris 2.8) 
# do not correctly set the timestamp due to buggy versions of `utime'
# in the kernel.  So, we use `echo' instead. 
STAMP = echo timestamp >

29 30
CC = @CC@
CFLAGS = @CFLAGS@
31
WARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANTIC@ @WERROR@
32 33 34
LDFLAGS = @LDFLAGS@
INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include
FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES)
35 36 37

# Directory where sources are, from where we are.
srcdir = @srcdir@
Bruce Korb committed
38
VPATH = $(srcdir)
39

Geoffrey Keating committed
40 41 42 43 44
# Directory in which to put the directories used by the compiler.
libdir = @libdir@
# Directory in which GCC puts its executables.
libexecdir = @libexecdir@

45 46
# End of variables for you to override.

Geoffrey Keating committed
47 48 49 50 51
# The target that we're configured for.
target = @target@
target_noncanonical:=@target_noncanonical@

# The version of GCC in this tree
52
gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
Geoffrey Keating committed
53 54

# Directory in which the compiler finds libraries etc.
55
libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
Geoffrey Keating committed
56 57 58 59 60 61 62 63 64 65
# Directory in which the compiler finds executables
libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
# Where our executable files go
itoolsdir = $(libexecsubdir)/install-tools
# Where our data files go
itoolsdatadir = $(libsubdir)/install-tools

# Locate mkinstalldirs.
mkinstalldirs=$(SHELL) $(srcdir)/../mkinstalldirs

66 67 68
AUTOCONF = autoconf
AUTOHEADER = autoheader
ACLOCAL = aclocal
69
ACLOCAL_AMFLAGS = -I .. -I ../config
70

71
default : all
72 73 74 75

# Now figure out from those variables how to compile and link.

.c.o:
76
	$(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CFLAGS) $<
77 78 79 80 81 82 83 84 85 86 87 88 89

# The only suffixes we want for implicit rules are .c and .o.
.SUFFIXES:
.SUFFIXES: .c .o

#

## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
##
##  Makefile for constructing the "best" include fixer we can
##
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

90
LIBIBERTY=../libiberty/libiberty.a
Bruce Korb committed
91 92

ALLOBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \
93
      fixlib.o fixopts.o
Bruce Korb committed
94

95 96
TESTOBJ = fixincl.o fixlib.o fixtests.o fixopts.o
FIXOBJ  = fixfixes.o fixlib.o fixopts.o
97

98
HDR = server.h fixlib.h
99 100
FI  = fixincl@EXEEXT@
AF  = applyfix@EXEEXT@
101

Geoffrey Keating committed
102
all : @TARGET@ fixinc.sh mkheaders
103
gen : $(srcdir)/fixincl.x
104

105

Bruce Korb committed
106 107 108
oneprocess : full-stamp
twoprocess : test-stamp $(AF)

109
full-stamp : $(ALLOBJ) $(LIBIBERTY)
110
	$(CC) $(CFLAGS) $(LDFLAGS) -o $(FI) $(ALLOBJ) $(LIBIBERTY)
111
	$(STAMP) $@
Bruce Korb committed
112

113
test-stamp : $(TESTOBJ) $(LIBIBERTY)
114
	$(CC) $(CFLAGS) $(LDFLAGS) -o $(FI) $(TESTOBJ) $(LIBIBERTY)
115
	$(STAMP) $@
Bruce Korb committed
116

117
$(AF): $(FIXOBJ) $(LIBIBERTY)
118
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(FIXOBJ) $(LIBIBERTY)
119

Bruce Korb committed
120 121
$(ALLOBJ)   : $(HDR)
fixincl.o   : fixincl.c  $(srcdir)/fixincl.x
122
fixtests.o  : fixtests.c
Bruce Korb committed
123
fixfixes.o  : fixfixes.c $(srcdir)/fixincl.x
124 125 126
server.o    : server.c
procopen.o  : procopen.c
fixlib.o    : fixlib.c
127

Geoffrey Keating committed
128 129 130
fixinc.sh : fixinc.in mkfixinc.sh Makefile
	srcdir="$(srcdir)" $(SHELL) $(srcdir)/mkfixinc.sh $(target)

131
$(srcdir)/fixincl.x: @MAINT@ fixincl.tpl inclhack.def
132
	cd $(srcdir) ; $(SHELL) ./genfixes
133

134 135
mostlyclean : 
	rm -f *.o *-stamp $(AF) $(FI) *~ fixinc.sh
136

137
clean: mostlyclean
138
	rm -f mkheaders mkheaders.almost
139 140 141 142 143

distclean: clean
	rm -f Makefile config.h config.log config.status stamp-h

maintainer-clean: distclean
144
	rm -f $(srcdir)/fixincl.x
145

146 147
distclean : clean

148 149 150
Makefile: $(srcdir)/Makefile.in config.status
	$(SHELL) ./config.status Makefile

151 152 153 154 155 156 157
mkheaders.almost: $(srcdir)/mkheaders.in config.status
	CONFIG_FILES=mkheaders.almost:mkheaders.in \
	CONFIG_HEADERS= ./config.status

mkheaders: mkheaders.almost $(srcdir)/../gcc/BASE-VER
	sed -e 's/@gcc_version@/$(gcc_version)/' < $< > $@T
	mv -f $@T $@
Geoffrey Keating committed
158

159 160 161 162 163 164 165
config.h: stamp-h
stamp-h: $(srcdir)/config.h.in config.status
	$(SHELL) ./config.status config.h

config.status: $(srcdir)/configure
	$(SHELL) ./config.status --recheck

166
$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/aclocal.m4
167
	cd $(srcdir) && $(AUTOCONF)
168 169

$(srcdir)/config.h.in: @MAINT@ $(srcdir)/configure.ac
170
	cd $(srcdir) && $(AUTOHEADER)
171

172
$(srcdir)/aclocal.m4: @MAINT@ $(srcdir)/configure.ac
173
	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
174 175

check : all
176
	autogen -T $(srcdir)/check.tpl $(srcdir)/inclhack.def
177 178
	$(SHELL) ./check.sh $(srcdir)/tests/base
	@rm -f ./check.sh
Geoffrey Keating committed
179 180 181

install : all
	-rm -rf $(DESTDIR)$(itoolsdir)
182
	$(mkinstalldirs) $(DESTDIR)$(itoolsdir)
Geoffrey Keating committed
183 184 185 186
	$(mkinstalldirs) $(DESTDIR)$(itoolsdatadir)/include
	$(INSTALL_DATA) $(srcdir)/README-fixinc \
	  $(DESTDIR)$(itoolsdatadir)/include/README
	$(INSTALL_SCRIPT) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh
187
	$(INSTALL_PROGRAM) $(FI) $(DESTDIR)$(itoolsdir)/$(FI)
Geoffrey Keating committed
188
	$(INSTALL_SCRIPT) mkheaders $(DESTDIR)$(itoolsdir)/mkheaders
189

190
install-strip: install
191
	test -z '$(STRIP)' || $(STRIP) $(DESTDIR)$(itoolsdir)/$(FI)
192 193

.PHONY: all check install install-strip
194
.PHONY: dvi pdf info html install-pdf install-info install-html
195

196
dvi :
197
pdf :
198
info :
199
html :
200
install-pdf :
201
install-info :
202
install-html :
203
installcheck :