-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
65 lines (47 loc) · 1.02 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
-include Makefile.cfg
OBJDIR=obj
SRCDIR=src
_CC=gcc
LD=ld
CFLAGS = -std=c11 -Wall
DEFS += -D_POSIX_C_SOURCE=2 $(shell libpng-config --cflags)
ifdef STATIC
LDFLAGS = -static $(shell libpng-config --static --ldflags )
else
LDFLAGS = $(shell libpng-config --ldflags )
endif
_OBJS = sramcity.o cityedit.o pngmap.o main.o
ifdef PROFILE
CFLAGS += -pg
LDFLAGS += -pg
endif
ifdef RELEASE
DEFS += -xSSE3 -O3 -DNDEBUG
else
DEFS += -g -O0
endif
ifdef NESMODE
DEFS += -DNESMODE
endif
ifdef SDL_UI
_OBJS += sdl_ui.o ui_menu.o
DEFS += -DUSE_SDL_UI
CFLAGS += $(shell sdl2-config --cflags)
ifdef STATIC
LDFLAGS += $(shell sdl2-config --static-libs) -lSDL2_image
else
LDFLAGS += $(shell sdl2-config --libs) -lSDL2_image
endif
endif
CC = $(PREFIX)$(_CC)
OBJS = $(patsubst %,$(OBJDIR)/%,$(_OBJS))
install: snescityeditor
snescityeditor: $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
$(CC) -c -o $@ $< $(CFLAGS) $(DEFS)
$(OBJDIR):
mkdir $(OBJDIR)
clean:
rm -rf $(OBJDIR)/*.o snescityeditor
.PHONY: clean install