summaryrefslogtreecommitdiff
path: root/contrib/fixinc/Makefile
blob: 3b859855b3b4a20af2421e465d217646f653160b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
##
##  Makefile for constructing the "best" include fixer we can
##
##  $Id: Makefile,v 1.1 1998/03/20 16:19:41 korbb Exp $
##
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

OBJ = fixincl.o server.o regex.o
HDR = server.h regex.h
## LIB = -lgen
SH_TARGET  = inclhack.sh fixincl.sh
BIN_TARGET = fixincl
AG_TEXT    = $(SH_TARGET) fixincl.x \
	inclhack.def inclhack.tpl hackshell.tpl fixincl.tpl
TARGETS    = $(SH_TARGET) $(BIN_TARGET)

default : fixincl.sh

all : $(TARGETS)
sh  : $(SH_TARGET)

$(OBJ): $(HDR)
fixincl.o: fixincl.x

fixincl: $(OBJ)
	if $(CC) -o $@ $(OBJ) $(LIB) ; then : ; else \
	rm -f $@ ; echo false > $@ ; fi

regex.o: regex.c
	$(CC) -g -DSTDC_HEADERS=1 -c regex.c

fixincl.x: fixincl.tpl inclhack.def
	@if ( autogen --help > /dev/null 2>&1 ) ; then \
		echo autogen -T fixincl.tpl -b fixincl inclhack.def ; \
		autogen -T fixincl.tpl -b fixincl inclhack.def ; \
	else echo You need to install autogen ; touch $@ ; fi

inclhack.sh: inclhack.def inclhack.tpl hackshell.tpl
	@if ( autogen --help > /dev/null 2>&1 ) ; then \
		echo autogen inclhack.def ; \
		autogen inclhack.def ; \
	else echo You need to install autogen ; touch $@ ; fi

fixincl.sh: inclhack.def inclhack.tpl fixincl inclhack.sh
	@if ( ./fixincl -v > /dev/null 2>&1 ) ; then \
		if ( autogen --help > /dev/null 2>&1 ) ; then \
		echo autogen -DPROGRAM=1 -b fixincl inclhack.def ; \
		autogen -DPROGRAM=1 -b fixincl inclhack.def ; touch $@ ; \
		else echo You need to install autogen ; touch $@ ; fi ; \
	else cp inclhack.sh $@ ; echo cp inclhack.sh $@ ; fi

clean:
	rm -f *.o fixincl

install: fixincl.sh
	@rm -f ../../gcc/fixincl.sh ; \
		echo cp fixincl.sh ../../gcc ; \
		cp fixincl.sh ../../gcc ; \
		chmod +x ../../gcc/fixincl.sh
	@echo check for fixincl copy...
	@if ( ./fixincl -v > /dev/null 2>&1 ) ; then \
		echo cp fixincl ../../gcc/fixincl ; \
		cp fixincl ../../gcc/fixincl ; fi