summaryrefslogtreecommitdiffstats
path: root/Makefile.darwinx
blob: f9d97b63f2ee3d528dd30f4116c87c375d578e4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- makefile -*-
#
# Makefile for GRV under MacOS using DarwinX
#

SDLROOT  = /home/hpa/games/SDL_mac
SDL	 = $(SDLROOT)/SDL.framework/Versions/Current
SDLMAIN  = $(SDLROOT)/devel-lite

CC	 = darwinx-gcc -arch i386
CWARN	 = -W -Wall -Wno-pointer-sign
REQFLAGS = -D__unix__ -D_REENTRANT
OPTFLAGS = -O2 -g
INCLUDE  = -I$(SDL)/Headers
CFLAGS	 = $(CWARN) $(REQFLAGS) $(OPTFLAGS) $(INCLUDE)
LDFLAGS  = 
LIBS     =  -F$(SDLROOT) -framework SDL -framework Cocoa

INT	 = darwinx-install_name_tool

X	 = 
ALL	 = grv$(X) Grv.zip

APP	 = Grv.app

OBJS	 = grv.o drawlevel.o play.o action.o bullets.o mystery.o \
	   prefs.o intro.o \
	   utils.o scoretbl.o highscore.o \
	   netopen.o keyboard.o graphics.o grvfont.o random.o \
	   sysrand.o homedir.o \
	   SDLMain.o

SCORED   = grvscored.o scoretbl.o

.SUFFIXES: .c .o .i .s

all: $(ALL)

grv$(X): $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
	$(INT) -change '@rpath/SDL.framework/Versions/A/SDL' \
		'@executable_path/../Frameworks/SDL.framework/Versions/A/SDL' \
		$@

.c.o:
	$(CC) $(CFLAGS) -c -o $@ $<

.c.i:
	$(CC) $(CFLAGS) -E -o $@ $<

.c.s:
	$(CC) $(CFLAGS) -S -o $@ $<

grvfont.c: grvfont.psf psftoc.pl
	$(PERL) psftoc.pl < $< > $@ || rm -f $@

SDLMain.o: $(SDLMAIN)/SDLMain.m $(SDLMAIN)/SDLMain.h
	$(CC) $(CFLAGS) -I$(SDLMAIN) -c -o $@ $<

Grv.zip: grv$(X) Info.plist
	rm -f $@
	rm -rf $(APP)
	mkdir -p $(APP)/Contents/MacOS $(APP)/Contents/Frameworks
	cp Info.plist $(APP)/Contents/
	cp $< $(APP)/Contents/MacOS/
	cp -a $(SDLROOT)/SDL.framework $(APP)/Contents/Frameworks/
	find $(APP) -name Headers | xargs rm -rf
	zip -9r --symlinks $@ $(APP)

clean:
	rm -f *.o *.i *.s $(ALL)
	rm -rf $(APP)