Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 2.19 KB

Makefile

File metadata and controls

102 lines (71 loc) · 2.19 KB
 
Jan 5, 2004
Jan 5, 2004
1
Oct 29, 2006
Oct 29, 2006
2
# Quick Makefile by ryan c. gordon. (icculus@icculus.org)
Jan 5, 2004
Jan 5, 2004
3
4
CC := gcc
Jan 27, 2006
Jan 27, 2006
5
LD := gcc
Jan 5, 2004
Jan 5, 2004
6
7
8
BINDIR := bin
SRCDIR := .
Jul 14, 2004
Jul 14, 2004
9
# must be "macosx" or "unix" or "win32" ... not all necessarily work right now.
Sep 14, 2004
Sep 14, 2004
10
platform := macosx
Jul 14, 2004
Jul 14, 2004
11
12
13
# Add zlib support? Will compress all ADD/ADDORREPLACE/PATCH operations.
# If you're going to compress the patch anyhow, this might not be wanted.
Sep 14, 2004
Sep 14, 2004
14
use_zlib := false
Jul 14, 2004
Jul 14, 2004
15
16
# Unix/Mac will try fork() if this is false.
Jul 14, 2004
Jul 14, 2004
17
use_pthread := false
Jan 5, 2004
Jan 5, 2004
18
Jul 14, 2004
Jul 14, 2004
19
20
21
# you probably shouldn't touch anything below this line.
Jan 5, 2004
Jan 5, 2004
22
ifeq ($(strip $(platform)),macosx)
Apr 22, 2005
Apr 22, 2005
23
24
PLATFORMDEF := -DPLATFORM_UNIX=1 -DPLATFORM_MACOSX=1
PLATFORMSRCS := platform_unix.c
Jan 5, 2004
Jan 5, 2004
25
26
27
28
LDFLAGS := -framework Carbon
endif
ifeq ($(strip $(platform)),win32)
Apr 22, 2005
Apr 22, 2005
29
30
PLATFORMDEF := -DPLATFORM_WIN32=1
PLATFORMSRCS := platform_win32.c
Jan 5, 2004
Jan 5, 2004
31
32
33
endif
ifeq ($(strip $(platform)),unix)
Apr 22, 2005
Apr 22, 2005
34
35
PLATFORMDEF := -DPLATFORM_UNIX=1
PLATFORMSRCS := platform_unix.c
Jan 5, 2004
Jan 5, 2004
36
37
endif
Mar 23, 2005
Mar 23, 2005
38
#CFLAGS := $(PLATFORMDEF) -Wall -g -fsigned-char -fno-omit-frame-pointer -O0 -DDEBUG=1 -D_DEBUG=1
Sep 14, 2004
Sep 14, 2004
39
CFLAGS := $(PLATFORMDEF) -Wall -fsigned-char -fomit-frame-pointer -Os
Jan 5, 2004
Jan 5, 2004
40
May 18, 2005
May 18, 2005
41
ifeq ($(strip $(platform)),macosx)
Apr 22, 2005
Apr 22, 2005
42
43
44
CFLAGS += -mdynamic-no-pic
endif
May 30, 2004
May 30, 2004
45
46
47
48
ifeq ($(strip $(use_zlib)),true)
CFLAGS += -DUSE_ZLIB
LDFLAGS += -lz
endif
Jan 5, 2004
Jan 5, 2004
49
Jul 14, 2004
Jul 14, 2004
50
51
ifeq ($(strip $(use_pthread)),true)
CFLAGS += -DUSE_PTHREAD=1
Jul 14, 2004
Jul 14, 2004
52
53
54
ifneq ($(strip $(platform)),macosx)
LDFLAGS += -lpthread
endif
Jul 14, 2004
Jul 14, 2004
55
56
endif
Jan 27, 2006
Jan 27, 2006
57
58
59
CFLAGS += $(EXTRACFLAGS)
LDFLAGS += $(EXTRALDFLAGS)
Apr 22, 2005
Apr 22, 2005
60
MOJOPATCHSRCS := mojopatch.c md5.c ui.c ui_carbon.c ui_stdio.c $(PLATFORMSRCS)
Jan 5, 2004
Jan 5, 2004
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
OBJS1 := $(MOJOPATCHSRCS:.c=.o)
OBJS2 := $(OBJS1:.cpp=.o)
OBJS3 := $(OBJS2:.asm=.o)
OBJS4 := $(OBJS3:.m=.o)
MOJOPATCHOBJS := $(foreach f,$(OBJS4),$(BINDIR)/$(f))
MOJOPATCHSRCS := $(foreach f,$(MOJOPATCHSRCS),$(SRCDIR)/$(f))
.PHONY: all mojopatch clean distclean listobjs listsrcs
all : mojopatch
mojopatch : $(BINDIR)/mojopatch
$(BINDIR)/%.o: $(SRCDIR)/%.m
$(CC) -c -o $@ $< $(CFLAGS)
$(BINDIR)/%.o: $(SRCDIR)/%.cpp
$(CC) -c -o $@ $< $(CFLAGS)
$(BINDIR)/%.o: $(SRCDIR)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
$(BINDIR)/mojopatch : $(BINDIR) $(MOJOPATCHOBJS)
Jan 27, 2006
Jan 27, 2006
84
$(LD) $(LDFLAGS) -o $@ $(MOJOPATCHOBJS)
Jan 5, 2004
Jan 5, 2004
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
$(BINDIR):
mkdir -p $(BINDIR)
distclean : clean
clean:
rm -rf $(BINDIR)
listsrcs:
@echo $(MOJOPATCHSRCS)
listobjs:
@echo $(MOJOPATCHOBJS)
# end of Makefile ...