forked from orangeduck/Corange
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (41 loc) · 1.29 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
CC=gcc
AR=ar
INCS= -I ./include
C_FILES= $(wildcard src/*.c) $(wildcard src/*/*.c)
PLATFORM = $(shell uname)
ifeq ($(findstring Linux,$(PLATFORM)),Linux)
DYNAMIC=libcorange.so
STATIC=libcorange.a
CFLAGS= $(INCS) -std=gnu99 -Wall -Werror -Wno-unused -O3 -g -fPIC
LFLAGS= -lGL -lSDLmain -lSDL -shared
OBJ_FILES= $(addprefix obj/,$(notdir $(C_FILES:.c=.o)))
endif
ifeq ($(findstring Darwin,$(PLATFORM)),Darwin)
DYNAMIC=libcorange.so
STATIC=libcorange.a
CFLAGS= $(INCS) -std=gnu99 -Wall -Werror -Wno-unused -O3 -g -fPIC
LFLAGS= -lGL -lSDLmain -lSDL -shared
OBJ_FILES= $(addprefix obj/,$(notdir $(C_FILES:.c=.o)))
endif
ifeq ($(findstring MINGW,$(PLATFORM)),MINGW)
DYNAMIC=corange.dll
STATIC=corange.lib
CFLAGS= $(INCS) -std=gnu99 -Wall -Werror -Wno-unused -O3 -g
LFLAGS= -g -L ./lib -lmingw32 -lopengl32 -lSDLmain -lSDL -shared
OBJ_FILES= $(addprefix obj/,$(notdir $(C_FILES:.c=.o))) corange.res
endif
all: $(DYNAMIC) $(STATIC)
$(DYNAMIC): $(OBJ_FILES)
$(CC) $(OBJ_FILES) $(LFLAGS) -o $@
$(STATIC): $(OBJ_FILES)
$(AR) rcs $@ $(OBJ_FILES)
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_FILES)