mirror of
https://github.com/atomiczsec/Adrenaline
synced 2026-06-21 13:47:29 +00:00
52 lines
1.4 KiB
Makefile
52 lines
1.4 KiB
Makefile
override CC_X64 := x86_64-w64-mingw32-gcc
|
|
override CC_X86 := i686-w64-mingw32-gcc
|
|
STRIP_X64 ?= x86_64-w64-mingw32-strip
|
|
STRIP_X86 ?= i686-w64-mingw32-strip
|
|
|
|
# Force x64 always available, x86 always disabled (Linux CI)
|
|
COMPILER_X64_AVAILABLE := yes
|
|
COMPILER_X86_AVAILABLE := no
|
|
|
|
# Standard BOF compilation flags (optimized, position-independent)
|
|
CFLAGS := -Os -std=c99 \
|
|
-fno-stack-protector -fno-stack-check -mno-stack-arg-probe \
|
|
-fno-builtin -fno-builtin-memset -fno-builtin-memcpy -fno-builtin-memmove \
|
|
-nostdlib \
|
|
-fno-asynchronous-unwind-tables -fno-unwind-tables -fno-ident \
|
|
-Wall -Wextra -Wno-unused-parameter -Wno-unused-variable \
|
|
-fno-leading-underscore -fno-ms-extensions \
|
|
-I.
|
|
|
|
|
|
SRC = service_control.c
|
|
HEADERS = beacon.h
|
|
|
|
OBJS_X64 = $(patsubst %.c, %.x64.o, $(SRC))
|
|
OBJS_X86 = $(patsubst %.c, %.x86.o, $(SRC))
|
|
|
|
ALL_OBJS = $(OBJS_X64)
|
|
ifeq ($(COMPILER_X86_AVAILABLE),yes)
|
|
ALL_OBJS += $(OBJS_X86)
|
|
endif
|
|
|
|
all: $(ALL_OBJS)
|
|
|
|
# Object files depend on source AND all headers
|
|
%.x64.o: %.c $(HEADERS)
|
|
@echo "Building x64: $@"
|
|
$(CC_X64) $(CFLAGS) -c -o $@ $<
|
|
@if command -v $(STRIP_X64) >/dev/null 2>&1; then \
|
|
$(STRIP_X64) --strip-unneeded $@ 2>/dev/null || true; \
|
|
fi
|
|
|
|
%.x86.o: %.c $(HEADERS)
|
|
@echo "Building x86: $@"
|
|
$(CC_X86) $(CFLAGS) -c -o $@ $<
|
|
@if command -v $(STRIP_X86) >/dev/null 2>&1; then \
|
|
$(STRIP_X86) --strip-unneeded $@ 2>/dev/null || true; \
|
|
fi
|
|
|
|
|
|
clean:
|
|
rm -f *.o *.x64.o *.x86.o
|