OSDN Git Service

Makefile cleanup for interface tree. Now essentially with all the
[pg-rex/syncrep.git] / src / interfaces / ecpg / preproc / Makefile
1 subdir = src/interfaces/ecpg/preproc
2 top_builddir = ../../../..
3 include ../../../Makefile.global
4
5 MAJOR_VERSION=2
6 MINOR_VERSION=7
7 PATCHLEVEL=1
8
9 CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
10         -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
11         -DINCLUDE_PATH=\"$(includedir)\" 
12
13 OBJS=preproc.o pgc.o type.o ecpg.o ecpg_keywords.o output.o\
14     keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o
15
16 all: ecpg
17
18 ifdef SNPRINTF
19 OBJS+=$(top_builddir)/src/backend/port/snprintf.o
20
21 $(top_builddir)/src/backend/port/snprintf.o:
22         $(MAKE) -C $(top_builddir)/src/backend/port snprintf.o
23 endif
24
25
26 ecpg: $(OBJS)
27         $(CC) -o $@ $^ $(LDFLAGS)
28
29 $(srcdir)/preproc.c $(srcdir)/preproc.h: preproc.y
30         $(YACC) -d $(YFLAGS) $<
31         mv y.tab.c $(srcdir)/preproc.c
32         mv y.tab.h $(srcdir)/preproc.h
33
34 $(srcdir)/pgc.c: pgc.l
35         $(LEX) $(LFLAGS) $<
36         mv lex.yy.c $@
37
38 install: all installdirs
39         $(INSTALL_PROGRAM) ecpg$(X) $(bindir)
40
41 installdirs:
42         $(mkinstalldirs) $(bindir)
43
44 uninstall:
45         rm -f $(bindir)/ecpg$(X)
46
47 clean distclean:
48         rm -f *.o ecpg$(X)
49 # garbage from partial builds
50         rm -f y.tab.c y.tab.h lex.yy.c
51 # garbage from development
52         @rm -f core a.out *~ *.output *.tab.c
53
54 # `make clean' does not remove preproc.c, preproc.h, or pgc.c since we
55 # want to ship those files in the distribution for people with
56 # inadequate tools.
57 maintainer-clean: distclean
58         rm -f $(srcdir)/preproc.c $(srcdir)/preproc.h $(srcdir)/pgc.c
59
60
61 depend dep: preproc.c pgc.c
62         $(CC) -MM $(CFLAGS) *.c >depend
63
64 ifeq (depend,$(wildcard depend))
65 include depend
66 endif