-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
82 lines (63 loc) · 1.72 KB
/
Makefile
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
73
74
75
76
77
78
79
80
81
82
#
# Makefile for caswcx
#
TARGETDIR = ./install
IDIR = .
CC32 = i686-w64-mingw32-gcc
CPP32 = i686-w64-mingw32-g++
CC64 = x86_64-w64-mingw32-gcc
CPP64 = x86_64-w64-mingw32-g++
WRES32 = i686-w64-mingw32-windres
WRES64 = x86_64-w64-mingw32-windres
TARGET32 = $(TARGETDIR)/casMSX.wcx
TARGET64 = $(TARGETDIR)/casMSX.wcx64
RESDIR = res
ODIR = obj
ODIR32 = $(ODIR)/w32
ODIR64 = $(ODIR)/w64
DIR_GUARD = @mkdir -p $(@D)
#DEBUG = -DDEBUG
WINFLAGS = -s -DWINDOWS
CFLAGS = -shared -I./includes -I$(IDIR) -Wall -O3 $(WINFLAGS) $(DEBUG)
CFLAGS32 = $(CFLAGS) -m32 -Wl,--out-implib="$(ODIR32)/libcasMSX.wcx"
CFLAGS64 = $(CFLAGS) -m64 -Wl,--out-implib="$(ODIR64)/libcasMSX.wcx64"
LIBS =
_DEPS = wcxapi.h \
wcxhead.h \
cunicode.h \
types.h \
resource.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))
_OBJ = caswcx.o \
wcxapi.o \
cunicode.o
OBJ32 = $(patsubst %,$(ODIR32)/%,$(_OBJ))
OBJ64 = $(patsubst %,$(ODIR64)/%,$(_OBJ))
RESOURCES32 = $(ODIR32)/resources.res
RESOURCES64 = $(ODIR64)/resources.res
.PHONY: clean all
all: $(TARGET32) $(TARGET64)
$(ODIR32)/%.res: $(RESDIR)/%.rc
$(DIR_GUARD)
$(WRES32) -O coff -i $^ -o $@ -I.
$(ODIR64)/%.res: $(RESDIR)/%.rc
$(DIR_GUARD)
$(WRES64) -O coff -i $^ -o $@ -I.
$(ODIR32)/%.o: %.c $(DEPS)
$(DIR_GUARD)
$(CC32) -c -o $@ $< $(CFLAGS32)
$(ODIR64)/%.o: %.c $(DEPS)
$(DIR_GUARD)
$(CC64) -c -o $@ $< $(CFLAGS64)
$(ODIR32)/%.o: %.cpp $(DEPS)
$(DIR_GUARD)
$(CPP32) -c -o $@ $< $(CFLAGS32)
$(ODIR64)/%.o: %.cpp $(DEPS)
$(DIR_GUARD)
$(CPP64) -c -o $@ $< $(CFLAGS64)
$(TARGET32): $(OBJ32) $(RESOURCES32)
$(CC32) -o $@ $^ $(CFLAGS32) $(LIBS)
$(TARGET64): $(OBJ64) $(RESOURCES64)
$(CC64) -o $@ $^ $(CFLAGS64) $(LIBS)
clean:
rm -Rf $(ODIR) *~ core $(IDIR)/*~ $(TARGETDIR)/*.wcx*