# makefile for BOINC vboxwrapper application on Macintosh.
# This is invoked from BuildMacVboxWrapper.sh shell script.
# It should not be used by itself without the script.
# Updated 7/10/12 for Xcode 4.3 and later which are not at a fixed address
# Updated 4/10/15 to remove deleted files vboxlog.cpp and vboxlog.h
# Updated 4/14/15 for compatibility with Xcode 6
# Updated 2/6/23 to include additional search paths


BOINC_DIR = ../..
BOINC_API_DIR = $(BOINC_DIR)/api
BOINC_LIB_DIR = $(BOINC_DIR)/lib
BOINC_BUILD_DIR = $(BOINC_DIR)/mac_build/build/Deployment
BOINC_CONFIG_DIR =  $(BOINC_DIR)/clientgui/mac
FRAMEWORKS_DIR = /System/Library/Frameworks

CXXFLAGS = $(VARIANTFLAGS) \
    -g \
    -DAPP_GRAPHICS \
    -I$(BOINC_CONFIG_DIR) \
    -I$(BOINC_DIR) \
    -I$(BOINC_LIB_DIR) \
    -I$(BOINC_API_DIR) \
    -I$(PREFIX)/include \
    -L$(BOINC_BUILD_DIR) \
    -L$(PREFIX)/lib \
    -L.

OBJ = \
    floppyio.o \
    vbox_common.o \
    vbox_vboxmanage.o \
    vboxcheckpoint.o \
    vboxjob.o \
    vboxlogging.o \
    vboxwrapper.o

PROGS = vboxwrapper

all: $(PROGS)

clean:
	/bin/rm -f $(PROGS) $(OBJ)

floppyio.o: floppyio.cpp
	$(CXX) $(CXXFLAGS) -c floppyio.cpp

vbox_common.o: vbox_common.cpp
	$(CXX) $(CXXFLAGS) -c vbox_common.cpp

vbox_vboxmanage.o: vbox_vboxmanage.cpp
	$(CXX) $(CXXFLAGS) -c vbox_vboxmanage.cpp

vboxcheckpoint.o: vboxcheckpoint.cpp
	$(CXX) $(CXXFLAGS) -c vboxcheckpoint.cpp

vboxjob.o: vboxjob.cpp
	$(CXX) $(CXXFLAGS) -c vboxjob.cpp

vboxlogging.o: vboxlogging.cpp
	$(CXX) $(CXXFLAGS) -c vboxlogging.cpp

vboxwrapper.o: vboxwrapper.cpp
	$(CXX) $(CXXFLAGS) -c vboxwrapper.cpp

vboxwrapper: vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(BOINC_BUILD_DIR)/libboinc.a $(BOINC_BUILD_DIR)/libboinc_api.a
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o vboxwrapper vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o -pthread -lboinc_api -lboinc
