forked from orangeduck/Corange
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
65 lines (47 loc) · 1.32 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
CC=gcc
AR=ar
SRC = $(wildcard src/*.c) $(wildcard src/*/*.c)
OBJ = $(addprefix obj/,$(notdir $(SRC:.c=.o)))
CFLAGS = -I ./include -std=gnu99 -Wall -Werror -Wno-unused -O3 -g
LFLAGS = -lSDL2 -lSDL2_mixer -lSDL2_net -shared -g
PLATFORM = $(shell uname)
ifeq ($(findstring Linux,$(PLATFORM)),Linux)
DYNAMIC = libcorange.so
STATIC = libcorange.a
CFLAGS += -fPIC
LFLAGS += -lGL
endif
ifeq ($(findstring Darwin,$(PLATFORM)),Darwin)
DYNAMIC = libcorange.so
STATIC = libcorange.a
CFLAGS += -fPIC
LFLAGS += -lGL
endif
ifeq ($(findstring MINGW,$(PLATFORM)),MINGW)
DYNAMIC = corange.dll
STATIC = libcorange.a
LFLAGS = -lmingw32 -lopengl32 -lSDL2main -lSDL2 -lSDL2_mixer -lSDL2_net -shared -g
OBJ += corange.res
endif
all: $(DYNAMIC) $(STATIC)
$(DYNAMIC): $(OBJ)
$(CC) $(OBJ) $(LFLAGS) -o $@
$(STATIC): $(OBJ)
$(AR) rcs $@ $(OBJ)
obj/%.o: src/%.c | obj
$(CC) $< -c $(CFLAGS) -o $@
obj/%.o: src/*/%.c | obj
$(CC) $< -c $(CFLAGS) -o $@
obj:
mkdir obj
corange.res: corange.rc
windres $< -O coff -o $@
clean:
rm $(OBJ) $(STATIC) $(DYNAMIC)
install_unix: $(STATIC)
cp $(STATIC) /usr/local/lib/$(STATIC)
install_win32: $(STATIC)
cp $(STATIC) C:/MinGW/lib/$(STATIC)
install_win64: $(STATIC) $(DYNAMIC)
cp $(STATIC) C:/MinGW64/x86_64-w64-mingw32/lib/$(STATIC)
cp $(DYNAMIC) C:/MinGW64/x86_64-w64-mingw32/bin/$(DYNAMIC)