Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,20 @@ else
endif

BIN=pkg2zip${EXE}
SRC=${wildcard pkg2zip*.c} miniz_tdef.c puff.c

# Detect architecture
UNAME_M := $(shell uname -m 2>/dev/null || echo unknown)

# Base source files
BASE_SRC := $(filter-out %_x86.c,$(wildcard pkg2zip*.c)) miniz_tdef.c puff.c

# Add x86-specific files only on x86/x86_64 architectures
ifneq ($(filter i386 i686 x86_64,$(UNAME_M)),)
SRC := $(BASE_SRC) $(wildcard pkg2zip*_x86.c)
else
SRC := $(BASE_SRC)
endif

OBJ=${SRC:.c=.o}
DEP=${SRC:.c=.d}

Expand All @@ -24,13 +37,16 @@ ${BIN}: ${OBJ}
@echo [L] $@
@${CC} ${LDFLAGS} -o $@ $^

# x86-specific compilation rules (only on x86/x86_64)
ifneq ($(filter i386 i686 x86_64,$(UNAME_M)),)
%aes_x86.o: %aes_x86.c
@echo [C] $<
@${CC} ${CFLAGS} -maes -mssse3 -MMD -c -o $@ $<

%crc32_x86.o: %crc32_x86.c
@echo [C] $<
@${CC} ${CFLAGS} -mpclmul -msse4 -MMD -c -o $@ $<
endif

%.o: %.c
@echo [C] $<
Expand Down