-
Notifications
You must be signed in to change notification settings - Fork 5
/
makefile
169 lines (162 loc) · 5.19 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
##################################
# #
# VMMenu MAKEFILE for all OS #
# For use with GNU Make #
# #
# Chad Gray, July 2020 #
# #
##################################
# #
# usage: #
# #
# make target=linux #
# make target=linuxdvg(default) #
# make target=Win32 #
# make target=DOS #
# make target=DOSAud #
# #
##################################
CC = gcc
LINK = gcc
CFLAGS= -W -Wall -O2 -s -g -ggdb3 -Wno-missing-braces
OBJ_DIR =obj
# Set the default target bulld here if not specified
ifndef target
target=linuxdvg
endif
ifeq ($(target),linux)
$(info Building for Linux ZVG)
VPATH=VMMSrc iniparser Linux Linux/zvg VMMSDL
INC = `sdl2-config --cflags` -I./VMMSrc -I./Linux -I./Linux/zvg -I./iniparser -I./VMMSDL
LIBS= `sdl2-config --libs` -lSDL2 -lSDL2_mixer -lm
CFLAGS += -DZEKTORZVG -Wno-missing-field-initializers
EXEC = vmmenu
RM = rm -f
RMDIR = rm -rf
MKDIR = mkdir -p $(1)
OBJS = $(OBJ_DIR)/$(EXEC).o \
$(OBJ_DIR)/zvgFrame.o \
$(OBJ_DIR)/zvgPort.o \
$(OBJ_DIR)/timer.o \
$(OBJ_DIR)/zvgEnc.o \
$(OBJ_DIR)/zvgError.o \
$(OBJ_DIR)/zvgBan.o \
$(OBJ_DIR)/iniparser.o \
$(OBJ_DIR)/dictionary.o \
$(OBJ_DIR)/LinuxVMM.o \
$(OBJ_DIR)/VMM-SDL.o \
$(OBJ_DIR)/hershey_font.o \
$(OBJ_DIR)/vmmenu_font.o \
$(OBJ_DIR)/gamelist.o \
$(OBJ_DIR)/editlist.o
endif
ifeq ($(target),linuxdvg)
$(info Building for Linux DVG)
VPATH=VMMSrc iniparser Linux Win32/dvg VMMSDL
INC = `sdl2-config --cflags` -I./VMMSrc -I./Linux -I./Win32/dvg -I./iniparser -I./VMMSDL
LIBS= `sdl2-config --libs` -lSDL2 -lSDL2_mixer -lm
CFLAGS += -DUSBDVG -Wno-missing-field-initializers
EXEC = vmmenu
RM = rm -f
RMDIR = rm -rf
MKDIR = mkdir -p $(1)
OBJS = $(OBJ_DIR)/$(EXEC).o \
$(OBJ_DIR)/zvgFrame.o \
$(OBJ_DIR)/timer.o \
$(OBJ_DIR)/iniparser.o \
$(OBJ_DIR)/dictionary.o \
$(OBJ_DIR)/LinuxVMM.o \
$(OBJ_DIR)/VMM-SDL.o \
$(OBJ_DIR)/hershey_font.o \
$(OBJ_DIR)/vmmenu_font.o \
$(OBJ_DIR)/gamelist.o \
$(OBJ_DIR)/editlist.o
endif
ifeq ($(target),Win32)
$(info Building for Win32)
VPATH=VMMSrc iniparser Win32 Win32/dvg VMMSDL
INC = -IC:/mingw_dev_lib/include/SDL2 -I./VMMSrc -I./Win32/dvg -I./iniparser -I./Win32 -I./VMMSDL
LIBS = -LC:\mingw_dev_lib\lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -lm
CFLAGS += -DUSBDVG -Wno-missing-field-initializers
EXEC = vmmenu.exe
RM = del
RMDIR = cmd /c rd /s /q
MKDIR = mkdir $(subst /,\,$(1)) > nul 2>&1 || (exit 0)
OBJS = $(OBJ_DIR)/vmmenu.o \
$(OBJ_DIR)/zvgFrame.o \
$(OBJ_DIR)/timer.o \
$(OBJ_DIR)/iniparser.o \
$(OBJ_DIR)/dictionary.o \
$(OBJ_DIR)/WinVMM.o \
$(OBJ_DIR)/VMM-SDL.o \
$(OBJ_DIR)/hershey_font.o \
$(OBJ_DIR)/vmmenu_font.o \
$(OBJ_DIR)/gamelist.o \
$(OBJ_DIR)/editlist.o
endif
ifeq ($(target),DOSAud)
$(info Building for DOS with SEAL audio)
VPATH=VMMSrc iniparser DOS DOS/zvg
INC = -IC:\djgpp\seal-1.07\src -I./DOS/zvg -I./DOS -I./iniparser -I./VMMSrc
LIBS = -LC:\djgpp\seal-1.07\lib\DOS -laudio
CFLAGS += -DZEKTORZVG
EXEC = svmmenu.exe
RM = del
RMDIR = cmd /c rd /s /q
MKDIR = mkdir -p $(1)
OBJS = $(OBJ_DIR)/vmmenu.o \
$(OBJ_DIR)/zvgFrame.o \
$(OBJ_DIR)/zvgPort.o \
$(OBJ_DIR)/timer.o \
$(OBJ_DIR)/zvgEnc.o \
$(OBJ_DIR)/zvgError.o \
$(OBJ_DIR)/zvgBan.o \
$(OBJ_DIR)/iniparser.o \
$(OBJ_DIR)/dictionary.o \
$(OBJ_DIR)/DOSvmmSL.o \
$(OBJ_DIR)/hershey_font.o \
$(OBJ_DIR)/vmmenu_font.o \
$(OBJ_DIR)/gamelist.o \
$(OBJ_DIR)/editlist.o
endif
ifeq ($(target),DOS)
$(info Building for DOS)
VPATH=VMMSrc iniparser DOS DOS/zvg
INC = -I./DOS/zvg -I./DOS -I./iniparser -I./VMMSrc
CFLAGS += -DZEKTORZVG
EXEC = vmmenu.exe
RM = del
RMDIR = cmd /c rd /s /q
MKDIR = mkdir -p $(1)
OBJS = $(OBJ_DIR)/vmmenu.o \
$(OBJ_DIR)/zvgFrame.o \
$(OBJ_DIR)/zvgPort.o \
$(OBJ_DIR)/timer.o \
$(OBJ_DIR)/zvgEnc.o \
$(OBJ_DIR)/zvgError.o \
$(OBJ_DIR)/zvgBan.o \
$(OBJ_DIR)/iniparser.o \
$(OBJ_DIR)/dictionary.o \
$(OBJ_DIR)/DOSvmm.o \
$(OBJ_DIR)/hershey_font.o \
$(OBJ_DIR)/vmmenu_font.o \
$(OBJ_DIR)/gamelist.o \
$(OBJ_DIR)/editlist.o
endif
all: $(EXEC)
# Clean up intermediate files
clean:
$(RM) $(EXEC)
$(RMDIR) $(OBJ_DIR)
# install
install:
# cp $(EXEC) /usr/local/sbin
chown root $(EXEC)
chmod u+s $(EXEC)
# Flags for linker
$(EXEC) : $(OBJS)
$(CC) -o $@ $^ $(LIBS)
# Flags for C compiler
$(OBJ_DIR)/%.o: %.c
@$(call MKDIR,$(@D))
$(CC) $(CFLAGS) -o $@ -c $< $(INC)