0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.119.115.40


Current Path : /var/www/html/gsh/libgd-gd-2.2.3/windows/
Upload File :
Current File : //var/www/html/gsh/libgd-gd-2.2.3/windows/Makefile.vc

# To build locally get a copy of the dependancies (http://windows.php.net/downloads/php-sdk/deps/)
# These are the dependencies used by PHP and largely used and tested. These binaries are built using
# the sources available at https://github.com/winlibs
# Then run 'nmake /f windows\Makefile.vc' in MS dev console
# To build tests as well 'nmake /f windows\Makefile.vc all'
# To build tests and execute them 'nmake /f windows\Makefile.vc check'

CC=cl
LD=link
LB=lib

!IFNDEF DEBUG
DEBUG=0
!ENDIF

!IFNDEF WITH_DEVEL
WITH_DEVEL=..\deps
!ENDIF

!IFNDEF WITH_BUILD
WITH_BUILD=..\gdbuild
!ENDIF

LIBGD_SRC_DIR=src
LIBGD_OBJ_DIR=$(WITH_BUILD)
LIBGD_BIN_DIR=$(WITH_BUILD)\bin
LIBGD_TEST_DIR=test

!IFNDEF PLATFORM
PLATFORM=x86
!ENDIF
# detect x64 cross-compiler env
!IF "$(PREFERREDTOOLARCHITECTURE)" == "x64"
PLATFORM=x64
!ENDIF
PLATFORM=$(PLATFORM:X=x)

BUILD_DIR=$(WITH_BUILD)

!MESSAGE library source:  $(LIBGD_SRC_DIR)

GD_DLL=libgd.dll
GD_LIB=libgd_a.lib

SDR=$(BUILD_DIR)^\
TDR=$(BUILD_DIR)\tests^\
TARGETDLL=$(BUILD_DIR)\$(GD_DLL)
TARGETLIB=$(BUILD_DIR)\$(GD_LIB)

LIB_OBJS= \
  $(LIBGD_OBJ_DIR)\gd.obj \
  $(LIBGD_OBJ_DIR)\gdcache.obj \
  $(LIBGD_OBJ_DIR)\gd_color.obj \
  $(LIBGD_OBJ_DIR)\gd_color_match.obj \
  $(LIBGD_OBJ_DIR)\gdfontg.obj \
  $(LIBGD_OBJ_DIR)\gdfontl.obj \
  $(LIBGD_OBJ_DIR)\gdfontmb.obj \
  $(LIBGD_OBJ_DIR)\gdfonts.obj \
  $(LIBGD_OBJ_DIR)\gdfontt.obj \
  $(LIBGD_OBJ_DIR)\gdft.obj \
  $(LIBGD_OBJ_DIR)\gdfx.obj \
  $(LIBGD_OBJ_DIR)\gd_filename.obj \
  $(LIBGD_OBJ_DIR)\gd_filter.obj \
  $(LIBGD_OBJ_DIR)\gd_bmp.obj \
  $(LIBGD_OBJ_DIR)\gd_gd2.obj \
  $(LIBGD_OBJ_DIR)\gd_gd.obj \
  $(LIBGD_OBJ_DIR)\gd_gif_in.obj \
  $(LIBGD_OBJ_DIR)\gd_gif_out.obj \
  $(LIBGD_OBJ_DIR)\gdhelpers.obj \
  $(LIBGD_OBJ_DIR)\gd_io.obj \
  $(LIBGD_OBJ_DIR)\gd_io_dp.obj \
  $(LIBGD_OBJ_DIR)\gd_io_file.obj \
  $(LIBGD_OBJ_DIR)\gd_io_ss.obj \
  $(LIBGD_OBJ_DIR)\gd_jpeg.obj \
  $(LIBGD_OBJ_DIR)\gd_security.obj \
  $(LIBGD_OBJ_DIR)\gd_tga.obj \
  $(LIBGD_OBJ_DIR)\gd_tiff.obj \
  $(LIBGD_OBJ_DIR)\gd_xbm.obj \
  $(LIBGD_OBJ_DIR)\gdkanji.obj \
  $(LIBGD_OBJ_DIR)\gd_nnquant.obj \
  $(LIBGD_OBJ_DIR)\gd_png.obj \
  $(LIBGD_OBJ_DIR)\gd_ss.obj \
  $(LIBGD_OBJ_DIR)\gdtables.obj \
  $(LIBGD_OBJ_DIR)\gd_topal.obj \
  $(LIBGD_OBJ_DIR)\gd_transform.obj \
  $(LIBGD_OBJ_DIR)\gd_wbmp.obj \
  $(LIBGD_OBJ_DIR)\gdxpm.obj \
  $(LIBGD_OBJ_DIR)\wbmp.obj \
  $(LIBGD_OBJ_DIR)\gd_interpolation.obj \
  $(LIBGD_OBJ_DIR)\gd_matrix.obj \
  $(LIBGD_OBJ_DIR)\gd_rotate.obj \
  $(LIBGD_OBJ_DIR)\gd_version.obj \
  $(LIBGD_OBJ_DIR)\gd_crop.obj \
  $(LIBGD_OBJ_DIR)\gd_color_map.obj \
  $(LIBGD_OBJ_DIR)\gd_webp.obj

LIBS=kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib Gdi32.Lib
LIBS_GD=libjpeg_a.lib freetype_a.lib libpng_a.lib libiconv_a.lib  zlib_a.lib libwebp_a.lib libxpm_a.lib

INCLUDES=/Isrc /I$(WITH_DEVEL)\include -I$(WITH_DEVEL)\include\libpng16 -I$(WITH_DEVEL)\include\freetype /Itests /Itests\gdtest -I$(WITH_DEVEL)\include\

LDFLAGS=/nologo /nodefaultlib:libcmt /libpath:$(WITH_DEVEL)\lib /MACHINE:$(PLATFORM)

!IF $(DEBUG)
CFLAGS=/nologo /Qvec-report:1 /MD /TC /Zi /Debug
!ELSE
CFLAGS=/nologo /O2 /Qvec-report:1 /MD /TC
!ENDIF

CFLAGS= $(CFLAGS) \
       /DWIN32=1\
       /D_WIN32=1\
       /DMSWIN32=1\
       /DBGDWIN32=1\
       /DHAVE_FT2BUILD_H=1\
       /DHAVE_GD_H=1\
       /DHAVE_ICONV_H=1\
       /DHAVE_GD_BUNDLED=1\
       /DHAVE_LIBFREETYPE=1\
       /DHAVE_LIBJPEG=1\
       /DHAVE_LIBPNG=1\
	   /DHAVE_LIBWEBP=1\
       /DHAVE_LIBZ=1\
	   /DHAVE_LIBXPM=1\
       $(INCLUDES)

TEST_CFLAGS=$(CFLAGS) /FItest_config.h
TEST_LDFLAGS=$(LDFLAGS) $(SDR)readdir.obj $(SDR)gdtest.obj $(BUILD_DIR)\libgd.lib
TEST_CONFIG=tests\test_config.h
TEST_LIST=$(TDR)testlist.txt
TEST_MK=$(TDR)Maketests.vc

# generate test makefile from TESTS macro
# generate test makefile from TESTS macro
!IF [if not exist $(BUILD_DIR) mkdir $(BUILD_DIR)]
!ENDIF
!IF [if not exist $(TDR) mkdir $(TDR)]
!ENDIF

!IF [$(MAKEDIR)\windows\gentest.bat tests $(BUILD_DIR) "$(TEST_CFLAGS)" "$(TEST_LDFLAGS)" $(CC) $(LD) "$(TEST_MK)" "$(TEST_LIST)"]
!ENDIF

TEST_OBJS=$(TEST_EXES:tests=obj)
TEST_OBJS=$(TEST_OBJS:exe=obj)

# pseudotargets
build_libs: make_dirs $(TARGETDLL) $(TARGETLIB)
all: build_libs build_tests
check: all run_tests

clean:
  @if exist $(SDR) rd $(SDR) /s /q
  @if exist $(TDR) rd $(TDR) /s /q
  @if exist $(BUILD_DIR)\*.exe del $(BUILD_DIR)\*.exe /q
  @if exist tests\test_config.h del tests\test_config.h /q

# helpers

make_dirs:
  @if not exist $(BUILD_DIR) mkdir $(BUILD_DIR)
  @if not exist $(SDR) mkdir $(SDR)

run_tests:
  @cd $(TDR)
  @$(MAKEDIR)\windows\run_tests

# libgd
$(LIBGD_OBJ_DIR):
	@if not exist $(LIBGD_OBJ_DIR) mkdir $(LIBGD_OBJ_DIR)

$(LIBGD_BIN_DIR):
	@if not exist $(LIBGD_BIN_DIR) mkdir $(LIBGD_BIN_DIR)

$(TARGETDLL): $(LIB_OBJS)
  @$(LD) /DLL /OUT:$@ $(LIB_OBJS) $(LIBS_GD) $(LIBS) $(LDFLAGS)

$(TARGETLIB): $(LIB_OBJS)
  @$(LB) /OUT:$@ $(LIB_OBJS) $(LDFLAGS)

{$(LIBGD_SRC_DIR)\}.c{$(LIBGD_OBJ_DIR)\}.obj:
	$(CC) $(CFLAGS) /Fo"$@"  $<

all: $(LIBGD_OBJ_DIR) $(LIBGD_BIN_DIR) $(LIB_OBJS) $(STATICLIB)

.SUFFIXES: .c .obj .res

{$(LIBGD_SRC_DIR)\}.c{$(LIBGD_OBJ_DIR)\}.obj:
	$(CC) $(CFLAGS) /Fo"$@" $<

{src\}.c{$(SDR)}.obj::
    $(CC) $(CFLAGS) /c $< /Fo$(SDR)
  
# tests

!INCLUDE $(TEST_MK)
build_tests: $(TEST_LIST) $(SDR)readdir.obj $(SDR)gdtest.obj $(TEST_EXES)

$(SDR)gdtest.obj: $(TARGETDLL) $(TEST_CONFIG) tests\gdtest\gdtest.c
  @$(CC) $(CFLAGS) /c tests\gdtest\gdtest.c /Fo$(SDR)gdtest.obj

$(SDR)readdir.obj: $(TARGETDLL) $(TEST_CONFIG) tests\gdtest\readdir.c
  @$(CC) $(CFLAGS) /c tests\gdtest\readdir.c /Fo$(SDR)readdir.obj
  
$(TEST_CONFIG):
  @echo #ifndef GD_TEST_CONFIG_H> tests\test_config.h
  @echo #define GD_TEST_CONFIG_H>> tests\test_config.h
  @echo #ifndef GDTEST_TOP_DIR>> tests\test_config.h
  @echo #define GDTEST_TOP_DIR "$(MAKEDIR:\=\\)\\tests">> tests\test_config.h
  @echo #endif>> tests\test_config.h
  @echo #ifndef _WIN32>> tests\test_config.h
  @echo #define snprintf _snprintf>> tests\test_config.h
  @echo #endif>> tests\test_config.h
  @echo #endif>> tests\test_config.h

$(TEST_LIST): $(TARGETDLL)
  if not exist $(TDR) mkdir $(TDR)
  copy $(TARGETDLL) $(TDR)$(GD_DLL)