summaryrefslogtreecommitdiff
path: root/gnu/lib/libg++/libiberty/Makefile.bsd-wrapper1
blob: be45f5e30c143524807c945d0711f7913b591cac (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
66
67
68
69
70
71
72
73
74
75
76
#	$OpenBSD: Makefile.bsd-wrapper1,v 1.2 1998/03/03 21:41:11 millert Exp $
#
#	XXX -- GNUism
#	This file's only purpose to help isolate
#       the funky GNU build mechanism!
#
CPPFLAGS+=      -I$(.CURDIR) -I$(.CURDIR)/../include -I$(.OBJDIR)

all:		alloca-conf.h config.h needed-list

alloca-conf.h: alloca-norm.h
	@echo Creating $(.TARGET) symlink
	@ln -s $(.ALLSRC) $(.TARGET)
#
# The following is more or less straight from the GNU makefile
# with pmake-isms added were needed.  Note that needed-list
# now contains .c's instead of .o's.
#
CONFIG_H = lconfig.h
NEEDED_LIST = lneeded-list
EXTRA_OFILES =

needed-list: stamp-picdir $(NEEDED_LIST)
	cp $(NEEDED_LIST) needed-list

lneeded-list: $(EXTRA_OFILES) needed.awk errors
	rm -f lneeded-list
	f=""; \
	for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
	  case " $$f " in \
	    *" $$i "*) ;; \
	    *) f="$$f $$i" ;; \
	  esac ; \
	done ; \
	echo $$f >>lneeded-list

# Generate an awk script that looks for functions in functions.def

needed.awk: $(.CURDIR)/functions.def
	echo "# !Automatically generated from $(.CURDIR)/functions.def"\
	  "- DO NOT EDIT!" >needed.awk
	grep '^DEF(' < $(.CURDIR)/functions.def \
	    | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.c " }|' \
	    >>needed.awk

config.h: $(CONFIG_H)
	cp $(CONFIG_H) config.h

lconfig.h: needed2.awk errors
	echo "/* !Automatically generated from $(.CURDIR)/functions.def"\
	  "- DO NOT EDIT! */" >lconfig.h
	awk -f needed2.awk <errors >>lconfig.h

# Generate an awk script that looks for variables in functions.def

needed2.awk: $(.CURDIR)/functions.def
	echo "# !Automatically generated from $(.CURDIR)/functions.def"\
	  "- DO NOT EDIT!" >needed2.awk
	grep '^DEFVAR(' < $(.CURDIR)/functions.def \
	 | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
	 >>needed2.awk
	grep '^DEFFUNC(' < $(.CURDIR)/functions.def \
	 | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
	 >>needed2.awk

dummy.o: $(.CURDIR)/dummy.c alloca-conf.h $(.CURDIR)/functions.def
	-$(CC) -c $(CFLAGS) $(CPPFLAGS) $(HDEFINES) $(.CURDIR)/dummy.c 2>/dev/null

errors: dummy.o $(EXTRA_OFILES)
	-($(CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true

stamp-picdir:
	if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
	  mkdir pic; \
	else true; fi
	touch stamp-picdir