1 # src/makefiles/Makefile.win32
4 BE_DLLLIBS= -L$(libdir) -lpostgres
5 override CPPFLAGS+= -I$(includedir_server)/port/win32
7 BE_DLLLIBS= -L$(top_builddir)/src/backend -lpostgres
8 override CPPFLAGS+="-I$(top_srcdir)/src/include/port/win32"
11 override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
13 ifneq (,$(findstring backend,$(subdir)))
14 ifeq (,$(findstring conversion_procs,$(subdir)))
15 ifeq (,$(findstring libpqwalreceiver,$(subdir)))
16 ifeq (,$(findstring replication/pgoutput,$(subdir)))
17 ifeq (,$(findstring snowball,$(subdir)))
18 override CPPFLAGS+= -DBUILDING_DLL
25 ifneq (,$(findstring src/common,$(subdir)))
26 override CPPFLAGS+= -DBUILDING_DLL
29 ifneq (,$(findstring src/port,$(subdir)))
30 override CPPFLAGS+= -DBUILDING_DLL
33 ifneq (,$(findstring timezone,$(subdir)))
34 override CPPFLAGS+= -DBUILDING_DLL
37 ifneq (,$(findstring ecpg/ecpglib,$(subdir)))
38 override CPPFLAGS+= -DBUILDING_DLL
41 # required by Python headers
42 ifneq (,$(findstring src/pl/plpython,$(subdir)))
43 override CPPFLAGS+= -DUSE_DL_IMPORT
46 # it is better to install shared-libraries anyway?
47 # may be overridden with make MAKE_DLL=false install
53 # Build rules to add versioninfo resources to win32 binaries
55 WIN32RES += win32ver.o
56 PGFTYPE = $(if $(shlib),VFT_DLL,VFT_APP)
58 PGICOSTR = $(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
61 # We do not install src/port/win32ver.rc, its content being specific to
62 # PostgreSQL Global Development Group software. Any module can ship a
63 # win32ver.rc or furnish a rule for generating one. Set $(PGFILEDESC) to
64 # signal win32ver.rc availability to the dll build rule below.
66 win32ver.rc: $(top_srcdir)/src/port/win32ver.rc
67 sed -e 's;FILEDESC;$(PGFILEDESC);' \
68 -e 's;VFT_APP;$(PGFTYPE);' \
69 -e 's;_ICO_;$(PGICOSTR);' \
70 -e '/_INTERNAL_NAME_/$(if $(shlib),s;_INTERNAL_NAME_;"$(basename $(shlib))";,d)' \
71 -e '/_ORIGINAL_NAME_/$(if $(shlib),s;_ORIGINAL_NAME_;"$(shlib)";,d)' \
74 # Depend on Makefile.global to force rebuild on re-run of configure.
75 win32ver.rc: $(top_builddir)/src/Makefile.global
78 win32ver.o: win32ver.rc
79 $(WINDRES) -i $< -o $@ --include-dir=$(top_builddir)/src/include --include-dir=$(srcdir)
81 # Rule for building a shared library from a single .o file
82 %.dll: %.o $(if $(PGFILEDESC),$(WIN32RES))
83 $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $^ -Wl,--export-all-symbols $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)