-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (35 loc) · 1012 Bytes
/
Copy pathMakefile
File metadata and controls
47 lines (35 loc) · 1012 Bytes
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
# compile main.c into a dll
# link main.h with main.c
# Link with the shared library dosato_lib.dll in the dosato_source directory
# Compiler
CC = gcc
# Compiler flags
CFLAGS = -Wall -Werror -Wno-format
# Include directories
INCLUDES = -I./dosato_source -I./src/include -I./src/include/SDL2
# Linker flags
LDFLAGS_WINDOWS = -L./dosato_source -llibdosato -L./src/lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer
LDFLAGS_LINUX = -L./dosato_source -ldosato -L./src/lib -lm -Wno-format -fPIC -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer
# Source files
SRCS = main.c
# Object files
OBJS = $(SRCS:.c=.o)
# Target
TARGET = graphics
# Detect OS
ifeq ($(OS),Windows_NT)
LDFLAGS = $(LDFLAGS_WINDOWS)
RM = del
TARGET := $(TARGET).dll
else
LDFLAGS = $(LDFLAGS_LINUX)
RM = rm -f
TARGET := $(TARGET).so
endif
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) $(INCLUDES) -shared -o $@ $^ $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
$(RM) $(TARGET) *.o