Skip to content

Commit 6392c38

Browse files
authored
Merge pull request #2783 from terrelln/huf-asm-makefiles
[build] Add support for ASM files in Make + CMake
2 parents 9d2a45a + 8bf699a commit 6392c38

File tree

16 files changed

+455
-336
lines changed

16 files changed

+455
-336
lines changed

.circleci/config.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ jobs:
77
# preinstalled to reduce installation time.
88
docker:
99
- image: fbopensource/zstd-circleci-primary:0.0.1
10+
# TODO: Re-enable aarch64 build:
11+
# make aarch64build && make clean
1012
steps:
1113
- checkout
1214
- run:
1315
name: Test
1416
command: |
1517
./tests/test-license.py
1618
cc -v; CFLAGS="-O0 -Werror -pedantic" make all && make clean
17-
make c99build ; make clean
18-
make c11build ; make clean
19-
make aarch64build ; make clean
20-
make -j regressiontest; make clean
21-
make shortest ; make clean
22-
make cxxtest ; make clean
19+
make c99build && make clean
20+
make c11build && make clean
21+
make -j regressiontest&& make clean
22+
make shortest && make clean
23+
make cxxtest && make clean
2324
# the second half of the jobs are in this test
2425
short-tests-1:
2526
docker:

.github/workflows/dev-short-tests.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ jobs:
200200
make clean && make -j all MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS"
201201
make clean && make check MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS"
202202
203+
test-variants:
204+
runs-on: ubuntu-latest
205+
steps:
206+
- uses: actions/checkout@v2
207+
- name: make all variants & validate
208+
run: |
209+
make -j -C programs allVariants MOREFLAGS=-O0
210+
./tests/test-variants.sh
211+
203212
204213
qemu-consistency:
205214
name: QEMU ${{ matrix.name }}
@@ -263,7 +272,6 @@ jobs:
263272
run: |
264273
LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
265274
266-
267275
# This test currently fails on Github Actions specifically.
268276
# Possible reason : TTY emulation.
269277
# Note that the same test works fine locally and on travisCI.

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ armbuild: clean
217217
CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd
218218

219219
aarch64build: clean
220-
CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
220+
CC=aarch64-linux-gnu-gcc CFLAGS="-Werror -O0" $(MAKE) allzstd
221221

222222
ppcbuild: clean
223223
CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) -j allzstd
@@ -381,23 +381,23 @@ cmakebuild:
381381

382382
c89build: clean
383383
$(CC) -v
384-
CFLAGS="-std=c89 -Werror" $(MAKE) allmost # will fail, due to missing support for `long long`
384+
CFLAGS="-std=c89 -Werror -O0" $(MAKE) allmost # will fail, due to missing support for `long long`
385385

386386
gnu90build: clean
387387
$(CC) -v
388-
CFLAGS="-std=gnu90 -Werror" $(MAKE) allmost
388+
CFLAGS="-std=gnu90 -Werror -O0" $(MAKE) allmost
389389

390390
c99build: clean
391391
$(CC) -v
392-
CFLAGS="-std=c99 -Werror" $(MAKE) allmost
392+
CFLAGS="-std=c99 -Werror -O0" $(MAKE) allmost
393393

394394
gnu99build: clean
395395
$(CC) -v
396-
CFLAGS="-std=gnu99 -Werror" $(MAKE) allmost
396+
CFLAGS="-std=gnu99 -Werror -O0" $(MAKE) allmost
397397

398398
c11build: clean
399399
$(CC) -v
400-
CFLAGS="-std=c11 -Werror" $(MAKE) allmost
400+
CFLAGS="-std=c11 -Werror -O0" $(MAKE) allmost
401401

402402
bmix64build: clean
403403
$(CC) -v

build/cmake/lib/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# in the COPYING file in the root directory of this source tree).
88
# ################################################################
99

10-
project(libzstd C)
10+
project(libzstd C ASM)
1111

1212
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
1313
option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON)
@@ -22,7 +22,7 @@ include_directories(${LIBRARY_DIR} ${LIBRARY_DIR}/common)
2222

2323
file(GLOB CommonSources ${LIBRARY_DIR}/common/*.c)
2424
file(GLOB CompressSources ${LIBRARY_DIR}/compress/*.c)
25-
file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c)
25+
file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c ${LIBRARY_DIR}/decompress/*.S)
2626
file(GLOB DictBuilderSources ${LIBRARY_DIR}/dictBuilder/*.c)
2727

2828
set(Sources

contrib/freestanding_lib/freestanding.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ def _log(self, *args, **kwargs):
460460
print(*args, **kwargs)
461461

462462
def _copy_file(self, lib_path):
463-
if not (lib_path.endswith(".c") or lib_path.endswith(".h")):
463+
suffixes = [".c", ".h", ".S"]
464+
if not any((lib_path.endswith(suffix) for suffix in suffixes)):
464465
return
465466
if lib_path in SKIPPED_FILES:
466467
self._log(f"\tSkipping file: {lib_path}")

contrib/linux-kernel/test/Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ CPPFLAGS += -DZSTD_ASAN_DONT_POISON_WORKSPACE
1818
LINUX_ZSTD_MODULE := $(wildcard $(LINUX_ZSTDLIB)/*.c)
1919
LINUX_ZSTD_COMMON := $(wildcard $(LINUX_ZSTDLIB)/common/*.c)
2020
LINUX_ZSTD_COMPRESS := $(wildcard $(LINUX_ZSTDLIB)/compress/*.c)
21-
LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c)
21+
LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c $(LINUX_ZSTDLIB)/decompress/*.S)
2222
LINUX_ZSTD_FILES := $(LINUX_ZSTD_MODULE) $(LINUX_ZSTD_COMMON) $(LINUX_ZSTD_COMPRESS) $(LINUX_ZSTD_DECOMPRESS)
23-
LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_FILES:.c=.o)
23+
LINUX_ZSTD_OBJECTS0 := $(LINUX_ZSTD_FILES:.c=.o)
24+
LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_OBJECTS0:.S=.o)
25+
26+
%.o: %.S
27+
$(CC) -c $(CPPFLAGS) $(CFLAGS) $^ -o $@
2428

2529
liblinuxzstd.a: $(LINUX_ZSTD_OBJECTS)
2630
$(AR) $(ARFLAGS) $@ $^

contrib/pzstd/Makefile

+2-14
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,6 @@ LD_COMMAND = $(CXX) $^ $(ALL_LDFLAGS) $(LIBS) -pthread -o $@
5757
CC_COMMAND = $(CC) $(DEPFLAGS) $(ALL_CFLAGS) -c $< -o $@
5858
CXX_COMMAND = $(CXX) $(DEPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
5959

60-
# Get a list of all zstd files so we rebuild the static library when we need to
61-
ZSTDCOMMON_FILES := $(wildcard $(ZSTDDIR)/common/*.c) \
62-
$(wildcard $(ZSTDDIR)/common/*.h)
63-
ZSTDCOMP_FILES := $(wildcard $(ZSTDDIR)/compress/*.c) \
64-
$(wildcard $(ZSTDDIR)/compress/*.h)
65-
ZSTDDECOMP_FILES := $(wildcard $(ZSTDDIR)/decompress/*.c) \
66-
$(wildcard $(ZSTDDIR)/decompress/*.h)
67-
ZSTDPROG_FILES := $(wildcard $(PROGDIR)/*.c) \
68-
$(wildcard $(PROGDIR)/*.h)
69-
ZSTD_FILES := $(wildcard $(ZSTDDIR)/*.h) \
70-
$(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) \
71-
$(ZSTDPROG_FILES)
72-
7360
# List all the pzstd source files so we can determine their dependencies
7461
PZSTD_SRCS := $(wildcard *.cpp)
7562
PZSTD_TESTS := $(wildcard test/*.cpp)
@@ -189,7 +176,8 @@ roundtrip: test/RoundTripTest$(EXT)
189176

190177
# Use the static library that zstd builds for simplicity and
191178
# so we get the compiler options correct
192-
$(ZSTDDIR)/libzstd.a: $(ZSTD_FILES)
179+
.PHONY: $(ZSTDDIR)/libzstd.a
180+
$(ZSTDDIR)/libzstd.a:
193181
CFLAGS="$(ALL_CFLAGS)" LDFLAGS="$(ALL_LDFLAGS)" $(MAKE) -C $(ZSTDDIR) libzstd.a
194182

195183
# Rules to build the tests

0 commit comments

Comments
 (0)