-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (33 loc) · 1.19 KB
/
Makefile
File metadata and controls
50 lines (33 loc) · 1.19 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
CXX = g++-10
INDIR = lib
BINDIR = bin
CXXFLAGS = -std=c++17 -Wall -F /Library/Frameworks -fPIC
SDLFLAGS = -framework SDL2 -framework SDL2_image
# --- this makefile is used to construct the .dylib file ---
all: wrap_lib
# ------------ SHARED LIBRARY CONSTRUCTION ------------
# var containing all object files needed to build library
_OBJS = sdl.o sdl_img.o sdl_exceptions.o sdl_window.o sdl_renderer.o sdl_surface.o sdl_texture.o
OBJS = $(patsubst %,$(BINDIR)/%,$(_OBJS))
# construct shared library -> uses ".dylib" for MAC OS
# we use "-dynamiclib" instead of "-shared" (for OS X?)
wrap_lib: $(OBJS)
$(CXX) $(SDLFLAGS) -dynamiclib -o libsdl_wrap.dylib $(BINDIR)/*.o
# construct respective object files
$(BINDIR)/%.o: $(INDIR)/%.cpp $(INDIR)/%.h
$(CXX) $(CXXFLAGS) -c -o $@ $<
# --- moving / setting-up commands ---
install: lib_copy h_copy
lib_copy: libsdl_wrap.dylib
cp libsdl_wrap.dylib /usr/local/lib
h_copy:
mkdir -p /usr/local/include/SDLwrap
cd lib && cp *.h /usr/local/include/SDLwrap
clean_setup:
rm /usr/local/lib/libsdl_wrap.dylib ; rm -r /usr/local/include/SDLwrap
# --- cleaning commands ---
clean: clean_obj clean_lib
clean_lib:
rm libsdl_wrap.dylib
clean_obj:
rm $(BINDIR)/*.o