Subversion Repositories Games.Prince of Persia

Rev

Rev 2 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

# Prince of Persia Makefile for macOS

NAME = Prince of Persia
CC = clang
HFILES = common.h config.h data.h proto.h types.h
OBJ = main.o data.o seg000.o seg001.o seg002.o seg003.o seg004.o seg005.o seg006.o seg007.o seg008.o seg009.o seqtbl.o replay.o options.o lighting.o screenshot.o
CFLAGS = -Wall -std=gnu99 -D_GNU_SOURCE=1 -D_THREAD_SAFE -DOSX -O2 -I. -F.
LDFLAGS = -lm -framework CoreServices -F. -framework SDL2 -framework SDL2_image -framework SDL2_mixer -rpath @executable_path/../Frameworks

all: $(OBJ)
        $(CC) -Wall -O2 -c xbrz.cpp
        $(CC) $(LDFLAGS) -lstdc++ $(OBJ) xbrz.o -o prince
        test -d "$(NAME).app" || mkdir "$(NAME).app"
        test -d "$(NAME).app/Contents" || mkdir "$(NAME).app/Contents"
        cp Info.plist "$(NAME).app/Contents"
        test -d "$(NAME).app/Contents/MacOS" || mkdir "$(NAME).app/Contents/MacOS"
        cp prince "$(NAME).app/Contents/MacOS/$(NAME)"
        test -d "$(NAME).app/Contents/Frameworks" || mkdir "$(NAME).app/Contents/Frameworks"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2.framework"
        cp -pPR SDL2.framework "$(NAME).app/Contents/Frameworks"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2.framework/Versions/A/_CodeSignature"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2.framework/Versions/A/Headers"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2.framework/Headers"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2_image.framework"
        cp -pPR SDL2_image.framework "$(NAME).app/Contents/Frameworks"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2_image.framework/Versions/A/_CodeSignature"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2_image.framework/Versions/A/Headers"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2_image.framework/Headers"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2_mixer.framework"
        cp -pPR SDL2_mixer.framework "$(NAME).app/Contents/Frameworks"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2_mixer.framework/Versions/A/_CodeSignature"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2_mixer.framework/Versions/A/Headers"
        rm -rf "$(NAME).app/Contents/Frameworks/SDL2_mixer.framework/Headers"
        test -d "$(NAME).app/Contents/Resources" || mkdir "$(NAME).app/Contents/Resources"
        cp icon.icns "$(NAME).app/Contents/Resources/$(NAME).icns"
        cp game.ini "$(NAME).app/Contents/Resources"
        cp -r data "$(NAME).app/Contents/Resources"

clean:
        rm -f $(OBJ) prince

distclean: clean
        rm -rf "$(NAME).app"

%.o: %.c $(HFILES)
        $(CC) $(CFLAGS) -c $<

.PHONY: all clean