webp/Makefile.vc
Pascal Massimino 56732a1b4d add idec.obj in MSVC makefile
Change-Id: I5064805991cdb811bc230cd184276bdd3abf017e
2011-03-24 06:38:39 -07:00

192 lines
4.9 KiB
Makefile

#
# Stem for static libs and DLLs
#
LIB_NAME = libwebp_a
LIB_NAME_DEBUG = libwebp_a_debug
#
# Stem for DLL import libs
#
IMPLIB_NAME = libwebp
IMPLIB_NAME_DEBUG = libwepb_debug
!IFNDEF DEP_PATH
DEPS_PATH = ../../deps
!ENDIF
!IFNDEF ARCH
ARCH = x86
!ENDIF
#############################################################
## 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
CFLAGS = /Isrc /nologo /W3 /EHsc /DWIN32 /FD /c /GS /D_CRT_SECURE_NO_WARNINGS
LDFLAGS = /LARGEADDRESSAWARE /MANIFEST /NXCOMPAT /SAFESEH /DYNAMICBASE
CFLAGSLIB = /DLIBWEBP_STATICLIB
LNKDLL = link.exe /DLL
LNKLIB = link.exe /lib
LNKEXE = link.exe
LFLAGS = /nologo /machine:$(ARCH)
CFLAGS = $(CFLAGS)
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
# release-static
!IF "$(CFG)" == "release-static"
TARGET = $(LIB_NAME).lib
LNK = $(LNKLIB) /out:$(DIRLIB)\$(TARGET)
CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB)
CFGSET = TRUE
!ENDIF
# debug-static
!IF "$(CFG)" == "debug-static"
TARGET = $(LIB_NAME_DEBUG).lib
LNK = $(LNKLIB) /out:$(DIRLIB)\$(TARGET)
CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB)
CFGSET = TRUE
!ENDIF
#######################
# Usage
#
!IF "$(CFGSET)" == "FALSE"
!MESSAGE Usage: nmake /f makefile.vc9 [CFG=<config>] [OBJDIR=<path>] [RTLIBCFG=<rtlib>] [<target>]
!MESSAGE where <config> is one of:
!MESSAGE - release-static - release static library
!MESSAGE - debug-static - debug static library
!MESSAGE - (empty) - perform a clean
!MESSAGE
!MESSAGE <rtlibcfg> controls the runtime library likage - can be 'static' or 'dynamic'.
!MESSAGE <target> can be left blank in which case all is assumed
!MESSAGE <path> is the path where you like to build (obj, bins, etc.)
!MESSAGE default to ..\obj\
!IF "$(CFG)" != ""
!MESSAGE
!ERROR please choose a valid configuration instead of "$(CFG)"
!ENDIF
!ENDIF
#######################
# Only the clean target can be used if a config was not provided.
#
!IF "$(CFGSET)" == "FALSE"
!MESSAGE
!MESSAGE No configuration provided - performing a clean.
clean:
@-erase /s *.dll 2> NUL
@-erase /s *.exp 2> NUL
@-erase /s *.idb 2> NUL
@-erase /s *.lib 2> NUL
@-erase /s *.obj 2> NUL
@-erase /s *.pch 2> NUL
@-erase /s *.pdb 2> NUL
@-erase /s *.res 2> NUL
!ELSE
# A config was provided, so the library can be built.
#
X_OBJS= \
$(DIROBJ)\dec\bits.obj \
$(DIROBJ)\dec\dsp.obj \
$(DIROBJ)\dec\frame.obj \
$(DIROBJ)\dec\quant.obj \
$(DIROBJ)\dec\tree.obj \
$(DIROBJ)\dec\vp8.obj \
$(DIROBJ)\dec\webp.obj \
$(DIROBJ)\dec\yuv.obj \
$(DIROBJ)\dec\idec.obj \
$(DIROBJ)\enc\analysis.obj \
$(DIROBJ)\enc\bit_writer.obj \
$(DIROBJ)\enc\config.obj \
$(DIROBJ)\enc\cost.obj \
$(DIROBJ)\enc\dsp.obj \
$(DIROBJ)\enc\frame.obj \
$(DIROBJ)\enc\filter.obj \
$(DIROBJ)\enc\iterator.obj \
$(DIROBJ)\enc\picture.obj \
$(DIROBJ)\enc\quant.obj \
$(DIROBJ)\enc\syntax.obj \
$(DIROBJ)\enc\tree.obj \
$(DIROBJ)\enc\webpenc.obj \
$(RESOURCE)
EXAMPLES_OBJS = \
$(DIROBJ)\examples\cwebp.obj \
$(DIROBJ)\examples\dwebp.obj
all: $(DIRLIB)\$(TARGET) $(DIRBIN)\dwebp.exe $(DIRBIN)\cwebp.exe
$(DIRLIB)\$(TARGET): $(X_OBJS)
$(LNK) $(LFLAGS) $(X_OBJS)
-xcopy $(DIROBJ)\$(LIB_NAME).dll $(DIRBIN) /y
-xcopy $(DIROBJ)\$(LIB_NAME).lib $(DIRLIB) /y
-xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll $(DIRBIN) /y
-xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib $(DIRLIB) /y
-xcopy $(DIROBJ)\$(IMPLIB_NAME).lib $(DIRLIB) /y
-xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib $(DIRLIB) /y
-xcopy $(DIROBJ)\*.exp $(DIRLIB) /y
-xcopy $(DIROBJ)\*.pdb $(DIRLIB) /y
$(X_OBJS): $(DIROBJ)\enc $(DIROBJ)\dec $(DIRLIB) $(DIRINC) $(DIRBIN)
$(EXAMPLES_OBJS): $(DIROBJ)\examples $(DIRLIB)\$(TARGET)
$(DIROBJ)\enc:
@if not exist "$(DIROBJ)\enc" mkdir $(DIROBJ)\enc
$(DIROBJ)\examples:
@if not exist "$(DIROBJ)\examples" mkdir $(DIROBJ)\examples
$(DIROBJ)\dec:
@if not exist "$(DIROBJ)\dec" mkdir $(DIROBJ)\dec
$(DIRLIB):
@if not exist "$(DIRLIB)" mkdir $(DIRLIB)
$(DIRINC):
@if not exist "$(DIRINC)" mkdir $(DIRINC)
$(DIRBIN):
@if not exist "$(DIRBIN)" mkdir $(DIRBIN)
.SUFFIXES: .c .obj .res .exe
{examples}.c{$(DIROBJ)\examples}.obj:
$(CC) $(CFLAGS) /Fo"$@" $<
{src\dec}.c{$(DIROBJ)\dec}.obj:
$(CC) $(CFLAGS) /Fo"$@" $<
{src\enc}.c{$(DIROBJ)\enc}.obj:
$(CC) $(CFLAGS) /Fo"$@" $<
{$(DIROBJ)\examples}.obj{$(DIRBIN)}.exe:
$(LNKEXE) $(LDFLAGS) /OUT:"$@" $< ole32.lib windowscodecs.lib shlwapi.lib $(DIRLIB)\$(TARGET)
$(MT) -manifest $@.manifest -outputresource:$@;1
del $@.manifest
!ENDIF # End of case where a config was provided.