mirror of
https://github.com/cuberite/libdeflate.git
synced 2025-09-08 11:50:00 -04:00

Move the x86 and ARM-specific code into their own directories to prevent it from cluttering up the main library. This will make it a bit easier to add new architecture-specific code. But to avoid complicating things too much for people who aren't using the provided Makefile, we still just compile all .c files for all architectures (irrelevant ones end up #ifdef'ed out), and the headers are included explicitly for each architecture so that an architecture-specific include path isn't needed. So, now people just need to compile both lib/*.c and lib/*/*.c instead of only lib/*.c.
66 lines
1.3 KiB
Makefile
66 lines
1.3 KiB
Makefile
#
|
|
# Makefile for the Microsoft toolchain
|
|
#
|
|
# Usage:
|
|
# nmake /f Makefile.msc
|
|
#
|
|
|
|
.SUFFIXES: .c .obj .dllobj
|
|
|
|
CC = cl
|
|
LD = link
|
|
AR = lib
|
|
CFLAGS = /MD /O2 -I. -Icommon
|
|
LDFLAGS =
|
|
|
|
STATIC_LIB = libdeflatestatic.lib
|
|
SHARED_LIB = libdeflate.dll
|
|
IMPORT_LIB = libdeflate.lib
|
|
|
|
STATIC_LIB_OBJ = \
|
|
lib/aligned_malloc.obj \
|
|
lib/adler32.obj \
|
|
lib/crc32.obj \
|
|
lib/deflate_compress.obj \
|
|
lib/deflate_decompress.obj \
|
|
lib/gzip_compress.obj \
|
|
lib/gzip_decompress.obj \
|
|
lib/x86/cpu_features.obj \
|
|
lib/zlib_compress.obj \
|
|
lib/zlib_decompress.obj
|
|
|
|
SHARED_LIB_OBJ = $(STATIC_LIB_OBJ:.obj=.dllobj)
|
|
|
|
PROG_COMMON_OBJ = programs/prog_util.obj \
|
|
programs/tgetopt.obj \
|
|
$(STATIC_LIB)
|
|
|
|
PROG_CFLAGS = $(CFLAGS) -Iprograms
|
|
|
|
all: $(STATIC_LIB) $(SHARED_LIB) $(IMPORT_LIB) gzip.exe gunzip.exe
|
|
|
|
.c.obj:
|
|
$(CC) -c /Fo$@ $(CFLAGS) $**
|
|
|
|
.c.dllobj:
|
|
$(CC) -c /Fo$@ $(CFLAGS) /DLIBDEFLATE_DLL $**
|
|
|
|
$(STATIC_LIB): $(STATIC_LIB_OBJ)
|
|
$(AR) $(ARFLAGS) -out:$@ $(STATIC_LIB_OBJ)
|
|
|
|
$(SHARED_LIB): $(SHARED_LIB_OBJ)
|
|
$(LD) $(LDFLAGS) -out:$@ -dll -implib:$(IMPORT_LIB) $(SHARED_LIB_OBJ)
|
|
|
|
$(IMPORT_LIB): $(SHARED_LIB)
|
|
|
|
gzip.exe:programs/gzip.obj $(PROG_COMMON_OBJ)
|
|
$(LD) $(LDFLAGS) -out:$@ $**
|
|
|
|
gunzip.exe:gzip.exe
|
|
copy $** $@
|
|
|
|
clean:
|
|
-del *.dll *.exe *.exp libdeflate.lib libdeflatestatic.lib gzip.lib \
|
|
lib\*.obj lib\*\*.obj lib\*.dllobj lib\*\*.dllobj \
|
|
programs\*.obj 2>nul
|