write_mac_tool/Makefile

39 lines
1.1 KiB
Makefile

# Makefile for update_mac.c with ARM (aarch64) cross-compile, matching dev_gaiban compile.sh
# Usage:
# make # default: build arm64
# make arm64 # build aarch64 binary using compile.sh toolchain
# make native # build native x86_64 binary (for local test)
# make toolchain # show cross compiler info
# make clean # remove binaries
SHELL := /bin/bash
COMPILE_SH ?= /home/hyx/work/dev_gaiban/APP_AP05_1.1.22_tuxi_shengchan/compile.sh
SRC := update_mac_yt.c
TARGET_ARM64 := update_mac_yt
TARGET_NATIVE := update_mac_yt_native
# Allow overriding CFLAGS via environment
CFLAGS ?= -O2 -Wall -I/home/hyx/work/write_mac_tool/hiredis
LDFLAGS ?= -lpthread /home/hyx/work/write_mac_tool/hiredis/libhiredis.a
.PHONY: all arm64 native clean toolchain
all: arm64
arm64: $(TARGET_ARM64)
$(TARGET_ARM64): $(SRC)
. $(COMPILE_SH) && $${CC} $(CFLAGS) -o $@ $< $(LDFLAGS)
native: $(TARGET_NATIVE)
$(TARGET_NATIVE): $(SRC)
gcc $(CFLAGS) -o $@ $< $(LDFLAGS)
# Show the configured cross toolchain
toolchain:
. $(COMPILE_SH) && echo "Using CC=$${CC}" && $${CC} -v || true
clean:
rm -f $(TARGET_ARM64) $(TARGET_NATIVE)