forked from PaulCombal/SamRewritten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (39 loc) · 1.83 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
CXX=g++ -std=c++17
OBJDIR=obj
LIBDIR?=lib
PREFIX=/usr
HFILES:=$(shell find src/ -type f -iname *.h -print)
CXXFILES:=$(shell find src/ -type f -iname *.cpp -print)
GTKFLAGS:=$(shell pkg-config gtkmm-3.0 --cflags --libs)
# For now, leave it to the distro to provide preferred extra flags
CXXFLAGS+=$(GTKFLAGS) -Wall -lsteam_api -lcurl -lyajl -ldl
LDFLAGS+=-L${CURDIR}/bin
OBJS=$(addprefix ${OBJDIR}/,$(subst .cpp,.o,${CXXFILES}))
all: ${CURDIR}/bin/samrewritten
@echo -e "==== Use '\033[1mmake dev\033[0m' to keep debug symbols"
@echo -e "==== Use '\033[1mmake clean\033[0m' to remove object files"
@echo -e "==== Nothing left to do."
dev: CXXFLAGS += -g -DDEBUG_CERR
dev: ${CURDIR}/bin/samrewritten
.PHONY: clean
clean:
rm -rf ${OBJDIR}
.PHONY: install
install: bin/launch.sh bin/samrewritten bin/libsteam_api.so
# TODO: use install for all of these?
mkdir -p ${DESTDIR}${PREFIX}/${LIBDIR}/SamRewritten/{bin,glade,assets}
mkdir -p ${DESTDIR}${PREFIX}/share/icons/hicolor/{64x64,256x256}/apps
mkdir -p ${DESTDIR}${PREFIX}/share/applications
mkdir -p ${DESTDIR}${PREFIX}/bin
cp $^ ${DESTDIR}${PREFIX}/${LIBDIR}/SamRewritten/bin/
ln -s ${DESTDIR}${PREFIX}/${LIBDIR}/SamRewritten/bin/launch.sh ${DESTDIR}${PREFIX}/bin/samrewritten
cp glade/main_window.glade ${DESTDIR}${PREFIX}/${LIBDIR}/SamRewritten/glade/main_window.glade
cp assets/icon_64.png ${DESTDIR}${PREFIX}/share/icons/hicolor/64x64/apps/samrewritten.png
cp assets/icon_256.png ${DESTDIR}${PREFIX}/share/icons/hicolor/256x256/apps/samrewritten.png
cp assets/icon_256.png ${DESTDIR}${PREFIX}/${LIBDIR}/SamRewritten/assets/
cp package/samrewritten.desktop ${DESTDIR}${PREFIX}/share/applications/
${CURDIR}/bin/samrewritten: $(OBJS)
${CXX} -o ${CURDIR}/bin/samrewritten $(OBJS) ${LDFLAGS} ${CXXFLAGS}
${OBJDIR}/%.o: %.cpp $(HFILES)
@mkdir -p $$(dirname $@)
$(CXX) -c -o $@ $< ${LDFLAGS} $(CXXFLAGS)