This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
63 lines (52 loc) · 1.47 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
# Modified from peanut-gb SDL example
NAME := suiCune
# Default compiler options for GCC and Clang
CC := cc
OBJEXT := o
RM := rm -f
EXEOUT := -o
EXTRA_CFLAGS := -std=c99 -Wall -Wextra -Wno-unused-label -Og -g3
EXE := $(NAME)
# File extension ".exe" is automatically appended on MinGW and MSVC builds, even
# if we don't ask for it.
ifeq ($(OS),Windows_NT)
STATIC := yes
EXE := $(NAME).exe
endif
TARGET := $(NAME)
SRCS := tools/emu/peanut_sdl.c tools/emu/minigb_apu/minigb_apu.c \
$(wildcard home/*.c) \
$(wildcard audio/*.c) \
$(wildcard engine/battle_anims/*.c) \
$(wildcard engine/gfx/*.c) \
$(wildcard engine/menus/*.c) \
$(wildcard engine/overworld/*.c)
# $(wildcard ../*/*/*/*.c)
CFLAGS += $(shell sdl2-config --cflags)
ifeq ($(STATIC),yes)
CFLAGS += -static
LDLIBS += $(shell sdl2-config --static-libs)
else
LDLIBS += $(shell sdl2-config --libs)
endif
LDLIBS += -lm
CFLAGS += $(EXTRA_CFLAGS)
OBJS := $(SRCS:.c=.$(OBJEXT))
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) $(EXEOUT)$@ $^ $(LDFLAGS) $(LDLIBS)
%.obj: %.c
$(CC) $(CFLAGS) $^
%.res: %.rc
rc /nologo /DCOMPANY="$(COMPANY)" /DDESCRIPTION="$(DESCRIPTION)" \
/DLICENSE="$(LICENSE)" /DGIT_VER="$(GIT_VER)" \
/DNAME="$(NAME)" /DICON_FILE="$(ICON_FILE)" $^
clean:
$(RM) $(SRCS:.c=.$(OBJEXT)) $(TARGET) \
$(wildcard home/*.o) \
$(wildcard audio/*.o) \
$(wildcard engine/battle_anims/*.o) \
$(wildcard engine/gfx/*.o) \
$(wildcard engine/menus/*.o) \
$(wildcard engine/overworld/*.o)
# $(wildcard ../*/*/*/*.o)