Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (64 loc) · 2.18 KB
/
Copy pathMakefile
File metadata and controls
76 lines (64 loc) · 2.18 KB
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
66
67
68
69
70
71
72
73
74
75
76
all: reinstead
SDLVER ?= sdl2
ifeq ($(SDLVER),sdl3)
SDL_CFLAGS=$(shell pkg-config --cflags sdl3)
SDL_LDFLAGS=$(shell pkg-config --libs sdl3)
SDL_DEFINE=-DUSE_SDL3
else
SDL_CFLAGS=$(shell pkg-config --cflags sdl2)
SDL_LDFLAGS=$(shell pkg-config --libs sdl2)
SDL_DEFINE=
endif
CFLAGS=$(SDL_CFLAGS) $(shell pkg-config --cflags luajit) -Isrc/instead -Dunix -Wall -O3 $(SDL_DEFINE)
LDFLAGS=$(SDL_LDFLAGS) $(shell pkg-config --libs luajit) -lm
# uncomment for system-wide install
# PREFIX=/usr/local
ifneq ($(PREFIX),)
DATADIR=-DDATADIR=\"$(PREFIX)/share/reinstead\"
install: reinstead
install -d -m 0755 $(DESTDIR)$(PREFIX)/bin
install -d -m 0755 $(DESTDIR)$(PREFIX)/share/reinstead
install -m 0755 reinstead $(DESTDIR)$(PREFIX)/bin
cp -r data/* $(DESTDIR)$(PREFIX)/share/reinstead
cat contrib/reinstead.desktop.in | sed -e 's|__prefix__|$(PREFIX)|' > reinstead.desktop
desktop-file-install --dir=$(DESTDIR)$(PREFIX)/share/applications reinstead.desktop
install -d -m 0755 $(DESTDIR)$(PREFIX)/share/pixmaps/
install -m 0644 contrib/reinstead.png $(DESTDIR)$(PREFIX)/share/pixmaps/
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/reinstead
rm -rf $(DESTDIR)$(PREFIX)/share/reinstead
rm -f $(DESTDIR)$(PREFIX)/share/applications/reinstead.desktop
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/reinstead.png
endif
CFILES= \
src/platform_sdl.c \
src/stb_image.c \
src/lua-compat.c \
src/stb_image_resize.c \
src/main.c \
src/gfx.c \
src/system.c \
src/instead/idf.c \
src/instead/lfs.c \
src/instead/util.c \
src/instead/cache.c \
src/instead/instead.c \
src/instead/xoshiro128.c \
src/instead/list.c \
src/instead_lib.c
ifneq ($(WITH_FREETYPE),)
CFILES += src/freetype/gfx_font.c
CFLAGS += $(shell pkg-config --cflags freetype2)
LDFLAGS += $(shell pkg-config --libs freetype2)
else ifneq ($(WITH_SCHRIFT),)
CFILES += src/schrift/gfx_font.c src/schrift/schrift.c
else
CFILES += src/gfx_font.c src/stb_truetype.c
endif
OFILES := $(patsubst %.c, %.o, $(CFILES))
$(OFILES): %.o : %.c
$(CC) -c $(<) $(I) $(CFLAGS) $(DATADIR) -o $(@)
reinstead: $(OFILES)
$(CC) $(CFLAGS) $(^) $(LDFLAGS) -o $(@)
clean:
$(RM) -f src/lua/*.o src/*.o src/instead/*.o src/freetype/*.o src/schrift/*.o src/sdl2/*.o src/sdl3/*.o reinstead