]> granicus.if.org Git - postgresql/blob - src/include/Makefile
$Header: -> $PostgreSQL Changes ...
[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 # $PostgreSQL: pgsql/src/include/Makefile,v 1.12 2003/11/29 19:52:08 pgsql Exp $
10 #
11 #-------------------------------------------------------------------------
12
13 subdir = src/include
14 top_builddir = ../..
15 include $(top_builddir)/src/Makefile.global
16
17
18 all: pg_config.h pg_config_os.h
19
20
21 # Install only selected headers
22
23 install: all installdirs remove-old-headers
24 # These headers are needed by the public headers of the interfaces.
25         $(INSTALL_DATA) $(srcdir)/postgres_ext.h   $(DESTDIR)$(includedir)
26         $(INSTALL_DATA) $(srcdir)/libpq/libpq-fs.h $(DESTDIR)$(includedir)/libpq
27         $(INSTALL_DATA) pg_config.h    $(DESTDIR)$(includedir)
28         $(INSTALL_DATA) pg_config_os.h $(DESTDIR)$(includedir)
29         $(INSTALL_DATA) $(srcdir)/pg_config_manual.h $(DESTDIR)$(includedir)
30 # These headers are needed by the not-so-public headers of the interfaces.
31         $(INSTALL_DATA) $(srcdir)/c.h            $(DESTDIR)$(includedir_internal)
32         $(INSTALL_DATA) $(srcdir)/port.h         $(DESTDIR)$(includedir_internal)
33         $(INSTALL_DATA) $(srcdir)/postgres_fe.h  $(DESTDIR)$(includedir_internal)
34         $(INSTALL_DATA) $(srcdir)/libpq/pqcomm.h $(DESTDIR)$(includedir_internal)/libpq
35         $(INSTALL_DATA) $(srcdir)/lib/dllist.h   $(DESTDIR)$(includedir_internal)/lib
36
37 installdirs:
38         $(mkinstalldirs) $(DESTDIR)$(includedir)/libpq $(DESTDIR)$(includedir_internal)/libpq $(DESTDIR)$(includedir_internal)/lib
39
40
41 # Install all headers
42
43 # Subdirectories containing headers that install-all-headers should install
44 SUBDIRS = access bootstrap catalog commands executor lib libpq mb \
45         nodes optimizer parser port regex rewrite storage tcop utils
46
47 install-all-headers: all install-all-dirs
48         $(INSTALL_DATA) pg_config.h    $(DESTDIR)$(includedir_server)
49         $(INSTALL_DATA) pg_config_os.h $(DESTDIR)$(includedir_server)
50         for file in $(srcdir)/*.h; do \
51           $(INSTALL_DATA) $$file $(DESTDIR)$(includedir_server)/`basename $$file` || exit; \
52         done
53         for dir in $(SUBDIRS); do \
54           for file in $(srcdir)/$$dir/*.h; do \
55             $(INSTALL_DATA) $$file $(DESTDIR)$(includedir_server)/$$dir/`basename $$file` || exit; \
56           done \
57         done
58
59 install-all-dirs:
60         $(mkinstalldirs) $(addprefix $(DESTDIR)$(includedir_server)/, $(SUBDIRS))
61
62
63 # Pre-7.1 Postgres installed some headers that are no longer installed by
64 # default.  If we see these headers in the target directory, zap them to
65 # avoid cross-version compile problems.  However, don't zap them if they
66 # match current sources (that means the user did install-all-headers).
67
68 remove-old-headers:
69         for file in fmgr.h postgres.h access/attnum.h commands/trigger.h \
70                 executor/spi.h utils/elog.h utils/geo_decls.h utils/mcxt.h \
71                 utils/palloc.h; do \
72                 if cmp -s $(srcdir)/$$file $(DESTDIR)$(includedir)/$$file; \
73                 then \
74                         : ; \
75                 else \
76                         rm -f $(DESTDIR)$(includedir)/$$file; \
77                 fi ; \
78         done
79
80
81 uninstall:
82         rm -f $(addprefix $(DESTDIR)$(includedir)/, pg_config.h pg_config_os.h postgres_ext.h libpq/libpq-fs.h)
83         rm -f $(addprefix $(DESTDIR)$(includedir_internal)/, c.h postgres_fe.h lib/dllist.h libpq/pqcomm.h)
84 # heuristic...
85         rm -rf $(addprefix $(DESTDIR)$(includedir_server)/, $(SUBDIRS) *.h)
86
87
88 clean:
89         rm -f utils/fmgroids.h parser/parse.h
90
91 distclean maintainer-clean: clean
92         rm -f pg_config.h dynloader.h pg_config_os.h stamp-h