OSDN Git Service

Changes to allow bypassing tests for certain machines
[pf3gnuchains/gcc-fork.git] / contrib / fixinc / Makefile
1
2 ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
3 ##
4 ##  Makefile for constructing the "best" include fixer we can
5 ##
6 ##  $Id: Makefile,v 1.4 1998/08/05 10:20:10 korbb Exp $
7 ##
8 ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
9
10 OBJ = fixincl.o server.o regex.o
11 HDR = server.h regex.h
12 ## LIB = -lgen
13 SH_TARGET  = inclhack.sh fixincl.sh
14 BIN_TARGET = fixincl
15 AG_TEXT    = $(SH_TARGET) fixincl.x \
16         inclhack.def inclhack.tpl hackshell.tpl fixincl.tpl
17 TARGETS    = $(SH_TARGET) $(BIN_TARGET)
18
19 default : gen
20
21 all : $(TARGETS)
22 sh  : $(SH_TARGET)
23 gen : $(SH_TARGET) fixincl.x
24
25 $(OBJ): $(HDR)
26
27 fixincl: $(OBJ)
28         @echo $(CC) -o $@ $(OBJ) $(LIB) ; \
29         if $(CC) -o $@ $(OBJ) $(LIB) ; then : ; else \
30         rm -f $@ ; (echo "#! /bin/sh" ; echo exit 1 ) > $@ ; \
31         chmod 777 $@ ; fi
32
33 regex.o: regex.c
34         -$(CC) -g -DSTDC_HEADERS=1 -c regex.c
35
36 fixincl.o : fixincl.x fixincl.c
37         -$(CC) $(CFLAGS) '-DTARGET_MACHINE="$(TARGET)"' -o $@ -c fixincl.c
38
39 server.o : server.c server.h
40         -$(CC) $(CFLAGS) -o $@ -c server.c
41
42 fixincl.x: fixincl.tpl inclhack.def
43         @if ( autogen --help > /dev/null 2>&1 ) ; then \
44                 echo autogen -T fixincl.tpl -b fixincl inclhack.def ; \
45                 autogen -T fixincl.tpl -b fixincl inclhack.def ; \
46         else echo You need to install autogen ; touch $@ ; fi
47
48 inclhack.sh: inclhack.def inclhack.tpl hackshell.tpl
49         @if ( autogen --help > /dev/null 2>&1 ) ; then \
50                 echo autogen inclhack.def ; \
51                 autogen inclhack.def ; \
52         else echo You need to install autogen ; touch $@ ; fi
53
54 fixincl.sh: inclhack.def inclhack.tpl
55         @if ( autogen --help > /dev/null 2>&1 ) ; then \
56                 echo autogen -DPROGRAM=1 -b fixincl inclhack.def ; \
57                 autogen -DPROGRAM=1 -b fixincl inclhack.def ; touch $@ ; \
58         else echo You need to install autogen ; touch $@ ; fi ; \
59
60 clean:
61         rm -f *.o $(TARGETS) fixincl.x
62
63 #  Ensure all the targets are built.  If the program "fixincl"
64 #  failed to compile, link or load, then we install the
65 #  "inclhack.sh" script.  Otherwise, we install that program
66 #  plus the wrapper script, "fixincl.sh".
67 #
68 install: $(TARGETS)
69         @rm -f $(DESTDIR)/fixinc.sh ; \
70         if ( ./fixincl -v > /dev/null 2>&1 ) ; then \
71                 echo cp fixincl.sh $(DESTDIR)/fixinc.sh ; \
72                 cp fixincl.sh $(DESTDIR)/fixinc.sh ; \
73                 chmod 555 $(DESTDIR)/fixinc.sh ; \
74         rm -f $(DESTDIR)/fixincl ; \
75                 echo cp fixincl $(DESTDIR) ; \
76                 cp fixincl $(DESTDIR) ; \
77                 chmod 555 $(DESTDIR)/fixincl ; \
78         else \
79                 echo cp inclhack.sh $(DESTDIR)/fixinc.sh ; \
80                 cp inclhack.sh $(DESTDIR)/fixinc.sh ; \
81         fi