]> granicus.if.org Git - postgresql/blob - src/include/Makefile
Clean out any old versions of no-longer-installed header files that may
[postgresql] / src / include / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for src/include
4 #
5 # 'make install' installs only those headers needed for client-side
6 # programming.  'make install-all-headers' installs the whole contents
7 # of src/include.
8 #
9 # $Header: /cvsroot/pgsql/src/include/Makefile,v 1.7 2001/02/20 20:37:13 tgl Exp $
10 #
11 #-------------------------------------------------------------------------
12
13 subdir = src/include
14 top_builddir = ../..
15 include $(top_builddir)/src/Makefile.global
16
17 # Headers needed by clients
18 srcdir_headers := c.h postgres_ext.h postgres_fe.h \
19         libpq/pqcomm.h libpq/libpq-fs.h lib/dllist.h
20
21 builddir_headers := os.h config.h
22
23 HEADERS = $(srcdir_headers) $(builddir_headers)
24
25 # Subdirectories containing headers that install-all-headers should install
26 SUBDIRS = access bootstrap catalog commands executor lib libpq mb \
27         nodes optimizer parser port regex rewrite storage tcop utils
28
29
30 all: $(HEADERS)
31
32
33 # Install only selected headers
34
35 install: all installdirs remove-old-headers
36         for file in $(srcdir_headers); do \
37           $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(includedir)/$$file || exit; \
38         done
39         for file in $(builddir_headers); do \
40           $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/$$file || exit; \
41         done
42
43 # Automatically pick out the needed subdirectories for the include tree.
44 installdirs:
45         $(mkinstalldirs) $(addprefix $(DESTDIR)$(includedir)/, $(sort $(dir $(HEADERS))))
46
47
48 # Install all headers
49
50 install-all-headers: all install-all-dirs
51         for file in $(srcdir)/*.h; do \
52           $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/`basename $$file` || exit; \
53         done
54         for dir in $(SUBDIRS); do \
55           for file in $(srcdir)/$$dir/*.h; do \
56             $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/$$dir/`basename $$file` || exit; \
57           done \
58         done
59         for file in $(builddir_headers); do \
60           $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/$$file || exit; \
61         done
62
63 install-all-dirs:
64         $(mkinstalldirs) $(addprefix $(DESTDIR)$(includedir)/, $(SUBDIRS))
65
66
67 # Pre-7.1 Postgres installed some headers that are no longer installed by
68 # default.  If we see these headers in the target directory, zap them to
69 # avoid cross-version compile problems.  However, don't zap them if they
70 # match current sources (that means the user did install-all-headers).
71
72 remove-old-headers:
73         for file in fmgr.h postgres.h access/attnum.h commands/trigger.h \
74                 executor/spi.h utils/elog.h utils/geo_decls.h utils/mcxt.h \
75                 utils/palloc.h; do \
76                 if cmp -s $(srcdir)/$$file $(DESTDIR)$(includedir)/$$file; \
77                 then \
78                         : ; \
79                 else \
80                         rm -f $(DESTDIR)$(includedir)/$$file; \
81                 fi \
82         done
83
84
85 # This isn't a complete uninstall, but rm'ing everything under
86 # $(DESTDIR)$(includedir) is probably too drastic...
87 uninstall:
88         rm -rf $(addprefix $(DESTDIR)$(includedir)/, $(HEADERS) $(SUBDIRS))
89
90 clean:
91         rm -f utils/fmgroids.h parser/parse.h
92
93 distclean maintainer-clean: clean
94         rm -f config.h dynloader.h os.h stamp-h