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)
16 ifneq (,$(findstring backend,$(subdir)))
17 ifeq (,$(findstring conversion_procs,$(subdir)))
18 ifeq (,$(findstring libpqwalreceiver,$(subdir)))
19 ifeq (,$(findstring replication/pgoutput,$(subdir)))
20 ifeq (,$(findstring snowball,$(subdir)))
21 override CPPFLAGS+= -DBUILDING_DLL
28 ifneq (,$(findstring src/common,$(subdir)))
29 override CPPFLAGS+= -DBUILDING_DLL
32 ifneq (,$(findstring src/port,$(subdir)))
33 override CPPFLAGS+= -DBUILDING_DLL
36 ifneq (,$(findstring timezone,$(subdir)))
37 override CPPFLAGS+= -DBUILDING_DLL
40 ifneq (,$(findstring ecpg/ecpglib,$(subdir)))
41 override CPPFLAGS+= -DBUILDING_DLL
44 # required by Python headers
45 ifneq (,$(findstring src/pl/plpython,$(subdir)))
46 override CPPFLAGS+= -DUSE_DL_IMPORT
49 # it is better to install shared-libraries anyway?
50 # may be overridden with make MAKE_DLL=false install
56 # Build rules to add versioninfo resources to win32 binaries
58 WIN32RES += win32ver.o
59 PGFTYPE = $(if $(shlib),VFT_DLL,VFT_APP)
61 PGICOSTR = $(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
64 # We do not install src/port/win32ver.rc, its content being specific to
65 # PostgreSQL Global Development Group software. Any module can ship a
66 # win32ver.rc or furnish a rule for generating one. Set $(PGFILEDESC) to
67 # signal win32ver.rc availability to the dll build rule below.
69 win32ver.rc: $(top_srcdir)/src/port/win32ver.rc
70 sed -e 's;FILEDESC;$(PGFILEDESC);' \
71 -e 's;VFT_APP;$(PGFTYPE);' \
72 -e 's;_ICO_;$(PGICOSTR);' \
73 -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' \
74 -e '/_INTERNAL_NAME_/$(if $(shlib),s;_INTERNAL_NAME_;"$(basename $(shlib))";,d)' \
75 -e '/_ORIGINAL_NAME_/$(if $(shlib),s;_ORIGINAL_NAME_;"$(shlib)";,d)' \
78 # Depend on Makefile.global to force rebuild on re-run of configure.
79 win32ver.rc: $(top_builddir)/src/Makefile.global
82 win32ver.o: win32ver.rc
83 $(WINDRES) -i $< -o $@ --include-dir=$(top_builddir)/src/include --include-dir=$(srcdir)
85 # Rule for building a shared library from a single .o file
86 %.dll: %.o $(if $(PGFILEDESC),$(WIN32RES))
87 $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $^ -Wl,--export-all-symbols $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)