summaryrefslogtreecommitdiff
path: root/games/endless-sky/files/Makefile.source
blob: 68593f46dc8989fe5b9147315bf0d04d753c9b30 (plain)
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
# $NetBSD: Makefile.source,v 1.2 2021/07/21 12:29:44 yhardy Exp $

#
# As of 0.9.12 the package's native build uses scons, and naturally it
# doesn't work. (It seems to compile ok, but ignores most of the
# install directives in the SConstruct script, for no obvious reason.)
#
# While the package is fairly large, the build is pretty simple and
# the SConstruct script is only 120 lines, so instead of arguing with
# scons I've transcribed the material here. We'll see if I regret this
# when it's time to update.
#
# Note: this makefile requires BSD make and is not expected to work
# outside of the context of pkgsrc.
#

DESTDIR?=
PREFIX?=/usr/local

BINDIR=		$(DESTDIR)$(PREFIX)/bin

CXXFLAGS+=-O3 -Isource -DBINDIR=\"$(BINDIR)\"
LIBS+=-lSDL2 -lpng -ljpeg -lGL -lGLEW -lopenal -lmad

CXXFLAGS+=	$(PTHREAD_CFLAGS)
LDFLAGS+=	$(PTHREAD_LDFLAGS)
LIBS+=		$(PTHREAD_LIBS)

PROG=endless-sky
SRCS!=find . -name '*.cpp' -print | sed -e 's,\./,,'

all: $(PROG)

$(PROG): $(SRCS:.cpp=.o)
	$(CXX) $(LDFLAGS) $(SRCS:T:.cpp=.o) $(LIBS) -o $(PROG)

.cpp.o:
	$(CXX) $(CXXFLAGS) -c $<

install:
	$(BSD_INSTALL_PROGRAM_DIR) $(BINDIR)
	$(BSD_INSTALL_PROGRAM) endless-sky $(BINDIR)/

.PHONY: all install