2018-01-21 10:31:38 +01:00
|
|
|
PROG = blobwarsAttrition
|
|
|
|
CC = gcc
|
|
|
|
PREFIX ?= /usr
|
|
|
|
BIN_DIR ?= $(PREFIX)/bin
|
|
|
|
DATA_DIR ?= /opt/$(PROG)
|
|
|
|
LOCALE_DIR = $(PREFIX)/share/locale
|
|
|
|
ICON_DIR = $(PREFIX)/share/icons/hicolor
|
|
|
|
DESKTOP_DIR = $(PREFIX)/share/applications
|
|
|
|
|
|
|
|
DESTDIR ?=
|
|
|
|
INST_BIN_DIR = $(DESTDIR)$(BIN_DIR)
|
|
|
|
INST_DATA_DIR = $(DESTDIR)$(DATA_DIR)
|
|
|
|
INST_LOCALE_DIR = $(DESTDIR)$(LOCALE_DIR)
|
|
|
|
INST_ICON_DIR = $(DESTDIR)$(ICON_DIR)
|
|
|
|
INST_DESKTOP_DIR = $(DESTDIR)$(DESKTOP_DIR)
|
|
|
|
|
|
|
|
SEARCHPATH += src/plat/unix
|
2018-02-09 20:20:18 +01:00
|
|
|
_OBJS += unixInit.o
|
2018-01-21 10:31:38 +01:00
|
|
|
|
|
|
|
include common.mk
|
|
|
|
|
2019-06-02 17:13:34 +02:00
|
|
|
NPROCS = $(shell grep -c 'processor' /proc/cpuinfo)
|
|
|
|
MAKEFLAGS += -j$(NPROCS)
|
|
|
|
|
2018-01-21 10:31:38 +01:00
|
|
|
CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\"
|
|
|
|
CXXFLAGS += -g -lefence
|
2018-01-28 09:30:53 +01:00
|
|
|
CXXFLAGS += -fms-extensions -std=gnu11
|
2018-12-28 12:00:45 +01:00
|
|
|
ifneq ("$(wildcard .errors)","")
|
|
|
|
CXXFLAGS += -Wall -Wempty-body -Werror -Wstrict-prototypes -Werror=maybe-uninitialized -Warray-bounds
|
|
|
|
endif
|
2018-01-21 10:31:38 +01:00
|
|
|
|
2018-03-09 19:26:33 +01:00
|
|
|
LDFLAGS += `sdl2-config --libs` -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lm -lz -lpng
|
2018-01-21 10:31:38 +01:00
|
|
|
|
2018-03-23 19:38:12 +01:00
|
|
|
SHARED_FILES = LICENSE README.md data gfx manual music sound icons
|
2018-01-21 10:31:38 +01:00
|
|
|
DIST_FILES = $(SHARED_FILES) locale $(PROG)
|
|
|
|
SRC_DIST_FILES = $(SHARED_FILES) src makefile* common.mk
|
|
|
|
|
|
|
|
# linking the program.
|
|
|
|
$(PROG): $(OBJS)
|
|
|
|
$(CC) -o $@ $(OBJS) $(LDFLAGS)
|
|
|
|
|
|
|
|
install:
|
|
|
|
mkdir -p $(INST_BIN_DIR)
|
|
|
|
install -m 0755 $(PROG) $(INST_BIN_DIR)
|
|
|
|
mkdir -p $(INST_DATA_DIR)
|
2018-03-19 23:52:00 +01:00
|
|
|
cp -r data $(INST_DATA_DIR)
|
2018-01-21 10:31:38 +01:00
|
|
|
cp -r gfx $(INST_DATA_DIR)
|
|
|
|
cp -r manual $(INST_DATA_DIR)
|
|
|
|
cp -r music $(INST_DATA_DIR)
|
|
|
|
cp -r sound $(INST_DATA_DIR)
|
|
|
|
mkdir -p $(INST_ICON_DIR)/16x16/apps
|
|
|
|
mkdir -p $(INST_ICON_DIR)/32x32/apps
|
|
|
|
mkdir -p $(INST_ICON_DIR)/64x64/apps
|
|
|
|
mkdir -p $(INST_ICON_DIR)/128x128/apps
|
|
|
|
cp -p icons/$(PROG)-16x16.png $(INST_ICON_DIR)/16x16/apps/$(PROG).png
|
|
|
|
cp -p icons/$(PROG)-32x32.png $(INST_ICON_DIR)/32x32/apps/$(PROG).png
|
|
|
|
cp -p icons/$(PROG)-64x64.png $(INST_ICON_DIR)/64x64/apps/$(PROG).png
|
|
|
|
cp -p icons/$(PROG)-128x128.png $(INST_ICON_DIR)/128x128/apps/$(PROG).png
|
|
|
|
mkdir -p $(INST_DESKTOP_DIR)
|
|
|
|
cp -p icons/$(PROG).desktop $(INST_DESKTOP_DIR)
|
2019-06-02 17:13:34 +02:00
|
|
|
|
2018-01-21 10:31:38 +01:00
|
|
|
@for f in $(LOCALE_MO); do \
|
|
|
|
lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \
|
|
|
|
mkdir -p $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES; \
|
|
|
|
cp -v $$f $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \
|
|
|
|
done
|
2019-06-02 17:13:34 +02:00
|
|
|
|
2018-01-21 10:31:38 +01:00
|
|
|
uninstall:
|
|
|
|
$(RM) $(BIN_DIR)/$(PROG)
|
|
|
|
$(RM) -rf $(DATA_DIR)
|
|
|
|
$(RM) $(ICON_DIR)/16x16/apps/$(PROG).png
|
|
|
|
$(RM) $(ICON_DIR)/32x32/apps/$(PROG).png
|
|
|
|
$(RM) $(ICON_DIR)/64x64/apps/$(PROG).png
|
|
|
|
$(RM) $(ICON_DIR)/128x128/apps/$(PROG).png
|
|
|
|
$(RM) $(DESKTOP_DIR)/$(PROG).desktop
|
2019-06-02 17:13:34 +02:00
|
|
|
|
2018-01-21 10:31:38 +01:00
|
|
|
@for f in $(LOCALE_MO); do \
|
|
|
|
lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \
|
|
|
|
$(RM) -v $(LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \
|
|
|
|
done
|
|
|
|
|
|
|
|
# prepare an archive for the program
|
|
|
|
dist:
|
2018-04-16 20:11:41 +02:00
|
|
|
$(RM) -rf $(PROG)-$(VERSION).$(REVISION)
|
|
|
|
mkdir $(PROG)-$(VERSION).$(REVISION)
|
|
|
|
cp -rL $(DIST_FILES) $(PROG)-$(VERSION).$(REVISION)
|
2018-05-18 08:42:14 +02:00
|
|
|
tar czf $(PROG)-$(VERSION).$(REVISION).linux-x86.tar.gz $(PROG)-$(VERSION).$(REVISION)
|
2018-01-21 10:31:38 +01:00
|
|
|
mkdir -p dist
|
2018-05-18 08:42:14 +02:00
|
|
|
mv $(PROG)-$(VERSION).$(REVISION).linux-x86.tar.gz dist
|
2018-04-16 20:11:41 +02:00
|
|
|
$(RM) -rf $(PROG)-$(VERSION).$(REVISION)
|
2019-06-02 17:13:34 +02:00
|
|
|
|
2018-01-21 10:31:38 +01:00
|
|
|
# prepare an archive for the program
|
|
|
|
src-dist:
|
2018-04-16 20:11:41 +02:00
|
|
|
$(RM) -rf $(PROG)-$(VERSION).$(REVISION)
|
|
|
|
mkdir $(PROG)-$(VERSION).$(REVISION)
|
|
|
|
cp -rL $(SRC_DIST_FILES) $(PROG)-$(VERSION).$(REVISION)
|
|
|
|
git log --pretty=format:"%h%x09%an%x09%ad%x09%s" --date=short >$(PROG)-$(VERSION).$(REVISION)/CHANGELOG.raw
|
2018-05-18 08:42:14 +02:00
|
|
|
tar czf $(PROG)-$(VERSION).$(REVISION).src.tar.gz $(PROG)-$(VERSION).$(REVISION)
|
2018-01-21 10:31:38 +01:00
|
|
|
mkdir -p dist
|
2018-05-18 08:42:14 +02:00
|
|
|
mv $(PROG)-$(VERSION).$(REVISION).src.tar.gz dist
|
2018-04-16 20:11:41 +02:00
|
|
|
$(RM) -rf $(PROG)-$(VERSION).$(REVISION)
|
2018-01-21 10:31:38 +01:00
|
|
|
|
|
|
|
.PHONY: dist
|