1#-------------------------------------------------------------------------
2#
3# Makefile for src/include
4#
5# 'make install' installs whole contents of src/include.
6#
7# src/include/Makefile
8#
9#-------------------------------------------------------------------------
10
11subdir = src/include
12top_builddir = ../..
13include $(top_builddir)/src/Makefile.global
14
15
16all: pg_config.h pg_config_ext.h pg_config_os.h
17
18
19# Subdirectories containing installable headers
20SUBDIRS = access bootstrap catalog commands common datatype \
21	executor fe_utils foreign jit \
22	lib libpq mb nodes optimizer parser partitioning postmaster \
23	regex replication rewrite \
24	statistics storage tcop snowball snowball/libstemmer tsearch \
25	tsearch/dicts utils port port/atomics port/win32 port/win32_msvc \
26	port/win32_msvc/sys port/win32/arpa port/win32/netinet \
27	port/win32/sys portability
28
29# Install all headers
30install: all installdirs
31# These headers are needed by the public headers of the interfaces.
32	$(INSTALL_DATA) $(srcdir)/postgres_ext.h   '$(DESTDIR)$(includedir)'
33	$(INSTALL_DATA) $(srcdir)/libpq/libpq-fs.h '$(DESTDIR)$(includedir)/libpq'
34	$(INSTALL_DATA) pg_config.h     '$(DESTDIR)$(includedir)'
35	$(INSTALL_DATA) pg_config_ext.h '$(DESTDIR)$(includedir)'
36	$(INSTALL_DATA) pg_config_os.h  '$(DESTDIR)$(includedir)'
37	$(INSTALL_DATA) $(srcdir)/pg_config_manual.h '$(DESTDIR)$(includedir)'
38# These headers are needed by the not-so-public headers of the interfaces.
39	$(INSTALL_DATA) $(srcdir)/c.h            '$(DESTDIR)$(includedir_internal)'
40	$(INSTALL_DATA) $(srcdir)/port.h         '$(DESTDIR)$(includedir_internal)'
41	$(INSTALL_DATA) $(srcdir)/postgres_fe.h  '$(DESTDIR)$(includedir_internal)'
42	$(INSTALL_DATA) $(srcdir)/libpq/pqcomm.h '$(DESTDIR)$(includedir_internal)/libpq'
43# These headers are needed for server-side development
44	$(INSTALL_DATA) pg_config.h     '$(DESTDIR)$(includedir_server)'
45	$(INSTALL_DATA) pg_config_ext.h '$(DESTDIR)$(includedir_server)'
46	$(INSTALL_DATA) pg_config_os.h  '$(DESTDIR)$(includedir_server)'
47	$(INSTALL_DATA) utils/errcodes.h '$(DESTDIR)$(includedir_server)/utils'
48	$(INSTALL_DATA) utils/fmgroids.h '$(DESTDIR)$(includedir_server)/utils'
49	$(INSTALL_DATA) utils/fmgrprotos.h '$(DESTDIR)$(includedir_server)/utils'
50# We don't use INSTALL_DATA for performance reasons --- there are a lot of files
51# (in fact, we have to take some pains to avoid overlength shell commands here)
52	cp $(srcdir)/*.h '$(DESTDIR)$(includedir_server)'/
53	for dir in $(SUBDIRS); do \
54	  cp $(srcdir)/$$dir/*.h '$(DESTDIR)$(includedir_server)'/$$dir/ || exit; \
55	done
56ifeq ($(vpath_build),yes)
57	for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h parser/gram.h storage/lwlocknames.h utils/probes.h; do \
58	  cp $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \
59	done
60endif
61	cd '$(DESTDIR)$(includedir_server)' && chmod $(INSTALL_DATA_MODE) *.h
62	for dir in $(SUBDIRS); do \
63	  cd '$(DESTDIR)$(includedir_server)'/$$dir || exit; \
64	  chmod $(INSTALL_DATA_MODE) *.h || exit; \
65	done
66
67installdirs:
68	$(MKDIR_P) '$(DESTDIR)$(includedir)/libpq' '$(DESTDIR)$(includedir_internal)/libpq'
69	$(MKDIR_P) $(addprefix '$(DESTDIR)$(includedir_server)'/, $(SUBDIRS))
70
71
72uninstall:
73	rm -f $(addprefix '$(DESTDIR)$(includedir)'/, pg_config.h pg_config_ext.h pg_config_os.h pg_config_manual.h postgres_ext.h libpq/libpq-fs.h)
74	rm -f $(addprefix '$(DESTDIR)$(includedir_internal)'/, c.h port.h postgres_fe.h libpq/pqcomm.h)
75# heuristic...
76	rm -rf $(addprefix '$(DESTDIR)$(includedir_server)'/, $(SUBDIRS) *.h)
77
78
79clean:
80	rm -f utils/fmgroids.h utils/fmgrprotos.h utils/errcodes.h utils/header-stamp
81	rm -f parser/gram.h storage/lwlocknames.h utils/probes.h
82	rm -f catalog/schemapg.h catalog/system_fk_info.h
83	rm -f catalog/pg_*_d.h catalog/header-stamp
84
85distclean maintainer-clean: clean
86	rm -f pg_config.h pg_config_ext.h pg_config_os.h stamp-h stamp-ext-h
87