2011-02-19 08:33:46 +01:00
|
|
|
#
|
|
|
|
# Stem for static libs and DLLs
|
|
|
|
#
|
|
|
|
LIB_NAME = libwebp_a
|
|
|
|
LIB_NAME_DEBUG = libwebp_a_debug
|
|
|
|
|
|
|
|
#
|
|
|
|
# Stem for DLL import libs
|
|
|
|
#
|
2011-07-15 23:53:03 +02:00
|
|
|
IMPLIB_NAME = libwebp_dll
|
|
|
|
IMPLIB_NAME_DEBUG = libwebp_dll_debug
|
2011-02-19 08:33:46 +01:00
|
|
|
|
|
|
|
!IFNDEF DEP_PATH
|
|
|
|
DEPS_PATH = ../../deps
|
|
|
|
!ENDIF
|
|
|
|
|
|
|
|
!IFNDEF ARCH
|
2011-06-01 03:58:01 +02:00
|
|
|
!IF ! [ cl 2>&1 | find "x86" > NUL ]
|
|
|
|
ARCH = x86
|
|
|
|
!ELSE IF ! [ cl 2>&1 | find "x64" > NUL ]
|
|
|
|
ARCH = x64
|
2011-05-26 16:50:46 +02:00
|
|
|
!ELSE
|
2011-06-01 03:58:01 +02:00
|
|
|
!ERROR Unable to auto-detect toolchain architecture! \
|
|
|
|
If cl.exe is in your PATH rerun nmake with ARCH=<arch>.
|
2011-02-19 08:33:46 +01:00
|
|
|
!ENDIF
|
2011-05-26 16:50:46 +02:00
|
|
|
!ENDIF
|
|
|
|
|
2011-06-01 03:58:01 +02:00
|
|
|
!IF "$(ARCH)" == "x86"
|
2011-05-26 16:50:46 +02:00
|
|
|
PLATFORM_LDFLAGS = /SAFESEH
|
|
|
|
!ENDIF
|
2011-02-19 08:33:46 +01:00
|
|
|
|
|
|
|
#############################################################
|
|
|
|
## Nothing more to do below this line!
|
|
|
|
|
|
|
|
MT = mt.exe
|
|
|
|
CCNODBG = cl.exe /nologo /O2 /DNDEBUG
|
|
|
|
CCDEBUG = cl.exe /nologo /Od /Gm /Zi /D_DEBUG /RTC1
|
2011-06-07 02:56:50 +02:00
|
|
|
CFLAGS = /Isrc /nologo /W3 /EHsc /FD /c /GS
|
2011-08-05 03:40:03 +02:00
|
|
|
CFLAGS = $(CFLAGS) /DWIN32 /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN
|
2012-01-05 03:38:07 +01:00
|
|
|
CFLAGS = $(CFLAGS) /DHAVE_WINCODEC_H /DWEBP_USE_THREAD /DNOT_HAVE_LOG2
|
2011-10-04 22:46:09 +02:00
|
|
|
LDFLAGS = /LARGEADDRESSAWARE /MANIFEST /NXCOMPAT /DYNAMICBASE
|
|
|
|
LDFLAGS = $(LDFLAGS) $(PLATFORM_LDFLAGS)
|
2011-02-19 08:33:46 +01:00
|
|
|
LNKDLL = link.exe /DLL
|
|
|
|
LNKLIB = link.exe /lib
|
|
|
|
LNKEXE = link.exe
|
|
|
|
LFLAGS = /nologo /machine:$(ARCH)
|
|
|
|
|
|
|
|
CFGSET = FALSE
|
|
|
|
!IF "$(OBJDIR)" == ""
|
|
|
|
OUTDIR = ..\obj\
|
|
|
|
!ELSE
|
|
|
|
OUTDIR = $(OBJDIR)
|
|
|
|
!ENDIF
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
# Runtime library configuration
|
|
|
|
!IF "$(RTLIBCFG)" == "static"
|
|
|
|
RTLIB = /MT
|
|
|
|
RTLIBD = /MTd
|
|
|
|
!ELSE
|
|
|
|
RTLIB = /MD
|
|
|
|
RTLIBD = /MDd
|
|
|
|
!ENDIF
|
|
|
|
DIRBASE = $(OUTDIR)\$(CFG)\$(ARCH)
|
|
|
|
DIROBJ = $(DIRBASE)\obj
|
|
|
|
DIRLIB = $(DIRBASE)\lib
|
|
|
|
DIRINC = $(DIRBASE)\include
|
|
|
|
DIRBIN = $(DIRBASE)\bin
|
2012-02-22 01:41:23 +01:00
|
|
|
LIBPDBNAME = $(DIROBJ)\$(TARGET).pdb
|
2011-10-04 22:39:39 +02:00
|
|
|
OUTPUT_DIRS = $(DIRBIN) $(DIRINC) $(DIRLIB) \
|
|
|
|
$(DIROBJ)\dec \
|
|
|
|
$(DIROBJ)\dsp \
|
|
|
|
$(DIROBJ)\enc \
|
|
|
|
$(DIROBJ)\examples \
|
|
|
|
$(DIROBJ)\mux \
|
|
|
|
$(DIROBJ)\utils \
|
2011-02-19 08:33:46 +01:00
|
|
|
|
2011-07-15 23:53:03 +02:00
|
|
|
# Target configuration
|
2011-02-19 08:33:46 +01:00
|
|
|
!IF "$(CFG)" == "release-static"
|
2011-07-15 23:53:03 +02:00
|
|
|
TARGET = $(LIB_NAME).lib
|
|
|
|
CC = $(CCNODBG)
|
|
|
|
STATICLIBBUILD = TRUE
|
|
|
|
!ELSE IF "$(CFG)" == "debug-static"
|
|
|
|
TARGET = $(LIB_NAME_DEBUG).lib
|
|
|
|
CC = $(CCDEBUG)
|
2012-02-21 22:44:39 +01:00
|
|
|
RTLIB = $(RTLIBD)
|
2011-07-15 23:53:03 +02:00
|
|
|
STATICLIBBUILD = TRUE
|
|
|
|
!ELSE IF "$(CFG)" == "release-dynamic"
|
|
|
|
TARGETDLL = $(LIB_NAME).dll
|
|
|
|
TARGET = $(IMPLIB_NAME).lib
|
|
|
|
CC = $(CCNODBG)
|
|
|
|
DLLBUILD = TRUE
|
|
|
|
!ELSE IF "$(CFG)" == "debug-dynamic"
|
|
|
|
TARGETDLL = $(LIB_NAME_DEBUG).dll
|
|
|
|
TARGET = $(IMPLIB_NAME_DEBUG).lib
|
|
|
|
CC = $(CCDEBUG)
|
2012-02-21 22:44:39 +01:00
|
|
|
RTLIB = $(RTLIBD)
|
2011-07-15 23:53:03 +02:00
|
|
|
DLLBUILD = TRUE
|
2011-02-19 08:33:46 +01:00
|
|
|
!ENDIF
|
|
|
|
|
2011-07-15 23:53:03 +02:00
|
|
|
!IF "$(STATICLIBBUILD)" == "TRUE"
|
|
|
|
CC = $(CC) $(RTLIB)
|
2011-02-19 08:33:46 +01:00
|
|
|
LNK = $(LNKLIB) /out:$(DIRLIB)\$(TARGET)
|
2011-07-15 23:53:03 +02:00
|
|
|
CFGSET = TRUE
|
|
|
|
!ELSE IF "$(DLLBUILD)" == "TRUE"
|
2012-02-21 22:44:39 +01:00
|
|
|
DLLC = webp_dll.c
|
2011-07-15 23:53:03 +02:00
|
|
|
DLLINC = webp_dll.h
|
|
|
|
CC = $(CC) /I$(DIROBJ) /FI$(DLLINC) $(RTLIB) /DWEBP_DLL
|
|
|
|
LNK = $(LNKDLL) /out:$(DIRBIN)\$(TARGETDLL) /implib:$(DIRLIB)\$(TARGET)
|
2012-02-21 22:44:39 +01:00
|
|
|
X_OBJS = $(DIROBJ)\$(DLLC:.c=.obj)
|
2012-02-22 01:41:23 +01:00
|
|
|
LIBPDBNAME = $(DIROBJ)\$(TARGETDLL).pdb
|
2011-02-19 08:33:46 +01:00
|
|
|
CFGSET = TRUE
|
|
|
|
!ENDIF
|
|
|
|
|
|
|
|
#######################
|
|
|
|
# Usage
|
|
|
|
#
|
|
|
|
!IF "$(CFGSET)" == "FALSE"
|
2011-10-04 22:46:09 +02:00
|
|
|
!MESSAGE Usage: nmake /f Makefile.vc [CFG=<config>]
|
|
|
|
!MESSAGE . [OBJDIR=<path>] [RTLIBCFG=<rtlib>] [<target>]
|
|
|
|
!MESSAGE
|
2011-02-19 08:33:46 +01:00
|
|
|
!MESSAGE where <config> is one of:
|
|
|
|
!MESSAGE - release-static - release static library
|
|
|
|
!MESSAGE - debug-static - debug static library
|
2011-07-15 23:53:03 +02:00
|
|
|
!MESSAGE - release-dynamic - release dynamic link library (DLL)
|
|
|
|
!MESSAGE - debug-dynamic - debug dynamic link library (DLL)
|
2011-10-04 22:46:09 +02:00
|
|
|
!MESSAGE
|
2011-06-02 00:55:22 +02:00
|
|
|
!MESSAGE <target> may be:
|
|
|
|
!MESSAGE - clean - perform a clean for CFG
|
2011-06-17 20:50:21 +02:00
|
|
|
!MESSAGE - experimental - build CFG with experimental
|
|
|
|
!MESSAGE . features enabled. Requires zlib.
|
2011-10-04 22:46:09 +02:00
|
|
|
!MESSAGE - (empty) or all - build all targets for CFG
|
2011-02-19 08:33:46 +01:00
|
|
|
!MESSAGE
|
2011-10-04 22:46:09 +02:00
|
|
|
!MESSAGE RTLIBCFG controls the runtime library linkage - 'static' or 'dynamic'.
|
|
|
|
!MESSAGE OBJDIR is the path where you like to build (obj, bins, etc.),
|
|
|
|
!MESSAGE defaults to ..\obj
|
2011-02-19 08:33:46 +01:00
|
|
|
|
|
|
|
!IF "$(CFG)" != ""
|
|
|
|
!MESSAGE
|
|
|
|
!ERROR please choose a valid configuration instead of "$(CFG)"
|
|
|
|
!ENDIF
|
|
|
|
!ENDIF
|
|
|
|
|
|
|
|
#######################
|
2011-06-02 00:55:22 +02:00
|
|
|
# Rules
|
2011-02-19 08:33:46 +01:00
|
|
|
#
|
2011-06-02 00:55:22 +02:00
|
|
|
!IF "$(CFGSET)" == "TRUE"
|
2011-02-19 08:33:46 +01:00
|
|
|
# A config was provided, so the library can be built.
|
|
|
|
#
|
|
|
|
|
|
|
|
X_OBJS= \
|
2011-10-04 22:46:09 +02:00
|
|
|
$(DIROBJ)\dec\alpha.obj \
|
|
|
|
$(DIROBJ)\dec\buffer.obj \
|
|
|
|
$(DIROBJ)\dec\frame.obj \
|
|
|
|
$(DIROBJ)\dec\idec.obj \
|
|
|
|
$(DIROBJ)\dec\io.obj \
|
|
|
|
$(DIROBJ)\dec\layer.obj \
|
|
|
|
$(DIROBJ)\dec\quant.obj \
|
|
|
|
$(DIROBJ)\dec\tree.obj \
|
|
|
|
$(DIROBJ)\dec\vp8.obj \
|
|
|
|
$(DIROBJ)\dec\webp.obj \
|
|
|
|
$(DIROBJ)\dsp\cpu.obj \
|
|
|
|
$(DIROBJ)\dsp\dec.obj \
|
|
|
|
$(DIROBJ)\dsp\dec_sse2.obj \
|
|
|
|
$(DIROBJ)\dsp\enc.obj \
|
|
|
|
$(DIROBJ)\dsp\enc_sse2.obj \
|
|
|
|
$(DIROBJ)\dsp\upsampling.obj \
|
|
|
|
$(DIROBJ)\dsp\upsampling_sse2.obj \
|
|
|
|
$(DIROBJ)\dsp\yuv.obj \
|
|
|
|
$(DIROBJ)\enc\alpha.obj \
|
|
|
|
$(DIROBJ)\enc\analysis.obj \
|
|
|
|
$(DIROBJ)\enc\config.obj \
|
|
|
|
$(DIROBJ)\enc\cost.obj \
|
|
|
|
$(DIROBJ)\enc\filter.obj \
|
|
|
|
$(DIROBJ)\enc\frame.obj \
|
|
|
|
$(DIROBJ)\enc\iterator.obj \
|
|
|
|
$(DIROBJ)\enc\layer.obj \
|
|
|
|
$(DIROBJ)\enc\picture.obj \
|
|
|
|
$(DIROBJ)\enc\quant.obj \
|
|
|
|
$(DIROBJ)\enc\syntax.obj \
|
|
|
|
$(DIROBJ)\enc\tree.obj \
|
|
|
|
$(DIROBJ)\enc\webpenc.obj \
|
2012-01-05 07:50:37 +01:00
|
|
|
$(DIROBJ)\mux\muxedit.obj \
|
|
|
|
$(DIROBJ)\mux\muxinternal.obj \
|
|
|
|
$(DIROBJ)\mux\muxread.obj \
|
2011-11-30 13:16:45 +01:00
|
|
|
$(DIROBJ)\utils\alpha.obj \
|
2011-10-04 22:46:09 +02:00
|
|
|
$(DIROBJ)\utils\bit_reader.obj \
|
|
|
|
$(DIROBJ)\utils\bit_writer.obj \
|
2012-01-05 08:34:30 +01:00
|
|
|
$(DIROBJ)\utils\filters.obj \
|
2011-11-30 13:16:45 +01:00
|
|
|
$(DIROBJ)\utils\quant_levels.obj \
|
|
|
|
$(DIROBJ)\utils\tcoder.obj \
|
2011-10-04 22:46:09 +02:00
|
|
|
$(DIROBJ)\utils\thread.obj \
|
2012-02-21 22:44:39 +01:00
|
|
|
$(X_OBJS) \
|
2011-02-19 08:33:46 +01:00
|
|
|
|
|
|
|
EXAMPLES_OBJS = \
|
2011-10-04 22:46:09 +02:00
|
|
|
$(DIROBJ)\examples\cwebp.obj \
|
|
|
|
$(DIROBJ)\examples\dwebp.obj \
|
|
|
|
$(DIROBJ)\examples\webpmux.obj
|
2011-02-19 08:33:46 +01:00
|
|
|
|
2011-09-30 11:44:06 +02:00
|
|
|
all: $(DIRLIB)\$(TARGET) $(DIRBIN)\dwebp.exe $(DIRBIN)\cwebp.exe \
|
|
|
|
$(DIRBIN)\webpmux.exe
|
2011-02-19 08:33:46 +01:00
|
|
|
|
2011-06-17 20:50:21 +02:00
|
|
|
# Additional include and library paths (for zlib) can be passed via the CL and
|
|
|
|
# LINK environment variables respectively:
|
|
|
|
# > set CL=/I\zlib\include
|
|
|
|
# > set LINK=\zlib\zlib.lib
|
|
|
|
# > nmake /f Makefile.vc CFG=release-static experimental
|
|
|
|
experimental:
|
|
|
|
$(MAKE) /f Makefile.vc \
|
2011-10-04 22:46:09 +02:00
|
|
|
CFG=$(CFG) \
|
|
|
|
CFLAGS="$(CFLAGS) /DWEBP_EXPERIMENTAL_FEATURES" /$(MAKEFLAGS)
|
2011-06-17 20:50:21 +02:00
|
|
|
|
2011-02-19 08:33:46 +01:00
|
|
|
$(DIRLIB)\$(TARGET): $(X_OBJS)
|
|
|
|
$(LNK) $(LFLAGS) $(X_OBJS)
|
2011-07-23 03:40:35 +02:00
|
|
|
-xcopy $(DIROBJ)\*.pdb $(DIRLIB) /y
|
2011-02-19 08:33:46 +01:00
|
|
|
|
2011-10-04 22:39:39 +02:00
|
|
|
$(X_OBJS): $(OUTPUT_DIRS)
|
2011-10-01 22:07:58 +02:00
|
|
|
|
2011-07-15 23:53:03 +02:00
|
|
|
!IF "$(DLLBUILD)" == "TRUE"
|
2012-02-21 22:44:39 +01:00
|
|
|
$(X_OBJS): $(DIROBJ)\$(DLLINC) $(DIROBJ)\$(DLLC)
|
|
|
|
|
|
|
|
{$(DIROBJ)}.c{$(DIROBJ)}.obj:
|
2012-02-22 01:41:23 +01:00
|
|
|
$(CC) $(CFLAGS) /Fd$(LIBPDBNAME) /Fo"$@" $<
|
2011-07-23 03:40:35 +02:00
|
|
|
clean::
|
2012-02-21 22:44:39 +01:00
|
|
|
@-erase /s $(DIROBJ)\$(DLLC) $(DIROBJ)\$(DLLINC) 2> NUL
|
2011-07-15 23:53:03 +02:00
|
|
|
!ENDIF
|
2011-02-19 08:33:46 +01:00
|
|
|
|
2011-10-04 22:39:39 +02:00
|
|
|
$(EXAMPLES_OBJS): $(DIRLIB)\$(TARGET)
|
2011-02-19 08:33:46 +01:00
|
|
|
|
2011-10-04 22:39:39 +02:00
|
|
|
$(OUTPUT_DIRS):
|
|
|
|
@if not exist "$(@)" mkdir "$(@)"
|
2011-02-19 08:33:46 +01:00
|
|
|
|
2011-07-15 23:53:03 +02:00
|
|
|
# generate a helper include to define WEBP_EXTERN suitable for the DLL build
|
|
|
|
$(DIROBJ)\$(DLLINC):
|
|
|
|
@echo #ifndef WEBP_DLL_H_ > $@
|
|
|
|
@echo #define WEBP_DLL_H_ >> $@
|
|
|
|
@echo #define WEBP_EXTERN(type) __declspec(dllexport) type >> $@
|
|
|
|
@echo #endif /* WEBP_DLL_H_ */ >> $@
|
|
|
|
|
2012-02-21 22:44:39 +01:00
|
|
|
# expose a WebPFree() function for use in managed code
|
|
|
|
$(DIROBJ)\$(DLLC): $(DIROBJ)\$(DLLINC)
|
|
|
|
@echo #include ^<stdlib.h^> > $@
|
|
|
|
@echo #include "webp_dll.h" >> $@
|
|
|
|
@echo // This function should be used in place of free() for memory >> $@
|
|
|
|
@echo // returned by the WebP API. >> $@
|
|
|
|
@echo WEBP_EXTERN(void) WebPFree(void* ptr) { >> $@
|
|
|
|
@echo free(ptr); >> $@
|
|
|
|
@echo } >> $@
|
|
|
|
|
2011-02-19 08:33:46 +01:00
|
|
|
.SUFFIXES: .c .obj .res .exe
|
|
|
|
{examples}.c{$(DIROBJ)\examples}.obj:
|
2012-02-22 01:41:23 +01:00
|
|
|
$(CC) $(CFLAGS) /Fd$@.pdb /Fo"$@" $<
|
2011-02-19 08:33:46 +01:00
|
|
|
{src\dec}.c{$(DIROBJ)\dec}.obj:
|
2012-02-22 01:41:23 +01:00
|
|
|
$(CC) $(CFLAGS) /Fd$(LIBPDBNAME) /Fo"$@" $<
|
2011-09-02 23:30:08 +02:00
|
|
|
{src\dsp}.c{$(DIROBJ)\dsp}.obj:
|
2012-02-22 01:41:23 +01:00
|
|
|
$(CC) $(CFLAGS) /Fd$(LIBPDBNAME) /Fo"$@" $<
|
2011-10-04 22:46:09 +02:00
|
|
|
{src\enc}.c{$(DIROBJ)\enc}.obj:
|
2012-02-22 01:41:23 +01:00
|
|
|
$(CC) $(CFLAGS) /Fd$(LIBPDBNAME) /Fo"$@" $<
|
2011-09-30 11:44:06 +02:00
|
|
|
{src\mux}.c{$(DIROBJ)\mux}.obj:
|
2012-02-22 01:41:23 +01:00
|
|
|
$(CC) $(CFLAGS) /Fd$(LIBPDBNAME) /Fo"$@" $<
|
2011-10-04 22:46:09 +02:00
|
|
|
{src\utils}.c{$(DIROBJ)\utils}.obj:
|
2012-02-22 01:41:23 +01:00
|
|
|
$(CC) $(CFLAGS) /Fd$(LIBPDBNAME) /Fo"$@" $<
|
2011-02-19 08:33:46 +01:00
|
|
|
|
|
|
|
{$(DIROBJ)\examples}.obj{$(DIRBIN)}.exe:
|
2011-10-04 22:46:09 +02:00
|
|
|
$(LNKEXE) $(LDFLAGS) /OUT:"$@" $< \
|
|
|
|
ole32.lib windowscodecs.lib shlwapi.lib $(DIRLIB)\$(TARGET)
|
2011-02-19 08:33:46 +01:00
|
|
|
$(MT) -manifest $@.manifest -outputresource:$@;1
|
|
|
|
del $@.manifest
|
|
|
|
|
2011-07-23 03:40:35 +02:00
|
|
|
clean::
|
2011-06-02 00:55:22 +02:00
|
|
|
@-erase /s $(DIROBJ)\*.dll 2> NUL
|
|
|
|
@-erase /s $(DIROBJ)\*.exp 2> NUL
|
|
|
|
@-erase /s $(DIROBJ)\*.idb 2> NUL
|
|
|
|
@-erase /s $(DIROBJ)\*.lib 2> NUL
|
|
|
|
@-erase /s $(DIROBJ)\*.obj 2> NUL
|
|
|
|
@-erase /s $(DIROBJ)\*.pch 2> NUL
|
|
|
|
@-erase /s $(DIROBJ)\*.pdb 2> NUL
|
|
|
|
@-erase /s $(DIROBJ)\*.res 2> NUL
|
|
|
|
|
2011-02-19 08:33:46 +01:00
|
|
|
!ENDIF # End of case where a config was provided.
|