summaryrefslogtreecommitdiff
path: root/Makefile.vc
blob: b8d53160e117365d1dd5f361c1114ded84947ba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Note: This does assume an existing GLib installation!
# Visual Studio builds of GLib does not need an existing pkg-config
# installation, so build GLib first before using this.

# Change these if necessary.  If building from GLib's included
# Visual Studio projects, this should be able to locate the GLib build
# out-of-the-box if they were not moved.  GLib's headers will be found
# in $(GLIB_PREFIX)\include\glib-2.0 and $(GLIB_PREFIX)\lib\glib-2.0\include
# and its import library will be found in $(GLIB_PREFIX)\lib.

GLIB_PREFIX = ..\vs$(VSVER)\$(PLAT)

# The items below this line should not be changed, unless one is maintaining
# the NMake Makefiles.

!include detectenv-msvc.mak

!if "$(VALID_CFGSET)" == "TRUE"
CFLAGS = $(CFLAGS_ADD) /W3 /Zi /FImsvc_recommended_pragmas.h /I.		\
	/I$(GLIB_PREFIX)\include\glib-2.0					\
	/I$(GLIB_PREFIX)\lib\glib-2.0\include

# PKG_CONFIG_SYSTEM_INCLUDE_PATH and PKG_CONFIG_SYSTEM_LIBRARY_PATH only
# work for GCC builds for now, so just set this to nothing for now

pkg_config_CFLAGS =	\
	$(CFLAGS)				\
	/DHAVE_CONFIG_H				\
	/DPKG_CONFIG_SYSTEM_INCLUDE_PATH="\"\""	\
	/DPKG_CONFIG_SYSTEM_LIBRARY_PATH="\"\""

LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(GLIB_PREFIX)\lib /DEBUG
NULL=

!if "$(CFG)" == "debug"
LDFLAGS = $(LDFLAGS_BASE)
!else
LDFLAGS = $(LDFLAGS_BASE) /opt:ref /LTCG
!endif

!include Makefile.sources

# Convert the source (*.c) listing to object (.obj) listing in
# another NMake Makefile module, include it, and clean it up.

!if [echo pkg_config_OBJS = \> objs.mak]
!endif

!if [for %c in ($(pkg_config_SOURCES)) do @if "%~xc" == ".c" echo. ^$(CFG)\^$(PLAT)\pkg-config\%~nc.obj \>> objs.mak]
!endif

!if [echo. ^$(NULL)>> objs.mak]
!endif

!include objs.mak

!if [del /f /q objs.mak]
!endif

pkg_config_LIBS = glib-2.0.lib

{}.c{$(CFG)\$(PLAT)\pkg-config\}.obj::
	$(CC) $(pkg_config_CFLAGS) /Fo$(CFG)\$(PLAT)\pkg-config\ /c @<<
$<
<<

all: $(CFG)\$(PLAT)\pkg-config.exe

$(CFG)\$(PLAT)\pkg-config.exe: $(CFG)\$(PLAT)\pkg-config config.h $(pkg_config_OBJS)
	link $(LDFLAGS) $(pkg_config_LIBS) -out:$@ @<<
$(pkg_config_OBJS)
<<
	@-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1

$(CFG)\$(PLAT)\pkg-config:
	@-mkdir $@

config.h: config.h.win32
	@-copy $@.win32 $@

clean:
	@-del /f /q $(CFG)\$(PLAT)\*.pdb
	@-del /f /q $(CFG)\$(PLAT)\*.exe.manifest
	@-del /f /q $(CFG)\$(PLAT)\*.exe
	@-del /f /q $(CFG)\$(PLAT)\*.ilk
	@-del /f /q $(CFG)\$(PLAT)\pkg-config\*.obj
	@-rmdir /s /q $(CFG)\$(PLAT)
	@-del vc$(VSVER)0.pdb
	@-del config.h

!else
all:
	@echo You need to specify a valid configuration, via
	@echo CFG=release or CFG=debug
!endif