hazelnut/agent/Makefile
2024-12-01 22:08:11 -05:00

90 lines
2.2 KiB
Makefile

include build/arch.mk
include build/configs.mk
NAME = hazelnut_agent
BINDIR = bin/$(ARCH)/$(CONFIG)
OBJDIR = obj/$(ARCH)/$(CONFIG)
VPATH = src/crt \
src/base \
src/ \
../shared/src
# Objects for crt
OBJS_STARTUP := $(OBJDIR)/crt0.o \
$(OBJDIR)/ctors.o \
$(OBJDIR)/exit.o
# Objects for base/ library
OBJS_BASELIB :=
OBJS := $(OBJDIR)/capture.o \
$(OBJDIR)/capture_nvfbc.o \
$(OBJDIR)/nvfbc_library.o \
$(OBJDIR)/ivshmem.o \
$(OBJDIR)/main.o \
LINK_LIBS := $(VS2022_PATH)/ucrt/lib/$(ARCH)/libucrt$(D).lib \
$(VS2022_PATH)/crt/lib/$(ARCH)/libcmt$(D).lib \
$(VS2022_PATH)/crt/lib/$(ARCH)/libcpmt$(D).lib \
$(VS2022_PATH)/crt/lib/$(ARCH)/libvcruntime$(D).lib \
$(VS2022_PATH)/winsdk/lib/$(ARCH)/kernel32.lib \
$(VS2022_PATH)/winsdk/lib/$(ARCH)/user32.lib \
$(VS2022_PATH)/winsdk/lib/$(ARCH)/comctl32.lib \
$(VS2022_PATH)/winsdk/lib/$(ARCH)/setupapi.lib \
.PHONY: all dumpinfo clean matrix
all: dumpinfo $(BINDIR)/$(NAME).exe
publish: $(BINDIR)/$(NAME).exe
cp -rv bin /data/sda/shit/Release/clangent
chmod -Rvv 777 /data/sda/shit/Release/clangent
publish2: $(BINDIR)/$(NAME).exe
cp -rv bin/ /data/sda/shit/Release/ivshtest/
chmod -Rvv 777 /data/sda/shit/Release/ivshtest
dumpinfo:
echo -e "\e[96mBuilding configuration $(CONFIG) for arch $(ARCH) \e[0m"
matrix:
# $(MAKE) ARCH=x86 CONFIG=Debug
# $(MAKE) ARCH=x86 CONFIG=Release
$(MAKE) ARCH=x64 CONFIG=Debug
$(MAKE) ARCH=x64 CONFIG=Release
# dir rules
$(BINDIR)/:
echo -e "\e[95mMKDIR $@\e[0m"
mkdir -p $(BINDIR)
$(OBJDIR)/:
echo -e "\e[95mMKDIR $@\e[0m"
mkdir -p $(OBJDIR)
$(BINDIR)/$(NAME).exe: $(BINDIR)/ $(OBJDIR)/ $(OBJS)
echo -e "\e[92mLinking binary $@\e[0m"
$(LD) /nodefaultlib /subsystem:console,6.1 /out:$@ $(LINK_LIBS) $(OBJS)
# todo: stuff rules in build/
$(OBJDIR)/%.o: %.c
echo -e "\e[94mCompiling C source file $< ($@)\e[0m"
$(CC) -c $(BASE_CCFLAGS) -Isdk/inc $($(CONFIG)_CCFLAGS) $< -o $@
$(OBJDIR)/%.o: %.cpp
echo -e "\e[94mCompiling C++ source file $< ($@)\e[0m"
$(CC) -c $(BASE_CXXFLAGS) -Isdk/inc $($(CONFIG)_CXXFLAGS) $< -o $@
$(OBJDIR)/%.o: res/%.rc
echo -e "\e[94mCompiling Windows resource script $<\e[0m"
$(RC) $(RC_INCLUDES) /FO $@ $<
clean: dumpinfo
echo -e "\e[91mCleaning... \e[0m"
rm -rf $(BINDIR)/ $(OBJDIR)/
$V.SILENT: