Add datadir

This commit is contained in:
Stefan Bühler 2009-08-07 14:51:23 +02:00
parent 37cafb67dc
commit d2e51f7389
2 changed files with 14 additions and 5 deletions

View File

@ -1,12 +1,12 @@
#DBG = -g
CC = gcc
WARNFLAGS = -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Winline -Wsign-compare -Wnested-externs -Wpointer-arith -Wformat-security
CFLAGS = -g -D_REENTRANT -O2 -Wall $(shell sdl-config --cflags) $(DBG) $(WARNFLAGS)
override CFLAGS += -D_REENTRANT -O2 $(shell sdl-config --cflags) $(DBG) $(WARNFLAGS)
.PHONY: all clean
.PHONY: all clean install
all: bomber
bomber: bomber.o gfx.o sound.o announce.o matcher
bomber: bomber.o gfx.o sound.o announce.o
gcc -o bomber bomber.o gfx.o sound.o announce.o $(shell sdl-config --libs) -lavahi-common -lavahi-client $(DBG)
matcher: matcher.c
@ -21,3 +21,9 @@ announce.o: announce.c announce.h
clean:
rm -f *.o matcher bomber
install: bomber
echo "Installing into $(DESTDIR)"
mkdir -p "$(DESTDIR)/usr/bin/" "$(DESTDIR)/usr/share/sdlbomber/"
install -m 0755 bomber "$(DESTDIR)/usr/bin/"
install -m 0644 data/*.pcx "$(DESTDIR)/usr/share/sdlbomber/"

View File

@ -19,6 +19,9 @@ static void domode(void);
static int iterate(void);
static int scaninvite(int size);
#ifndef DATADIR
#define DATADIR "."
#endif
#define FRACTION 9
#define MAXMSG 4096
@ -832,12 +835,12 @@ char tname[256];
memset(gs,0,sizeof(gfxset));
ileft=0;
sprintf(tname,"data/%s",name);
sprintf(tname,DATADIR "/%s",name);
ihand=open(tname,O_RDONLY);
if(ihand<0)
{
char tname2[256];
sprintf(tname2,"%s.pcx",tname);
sprintf(tname2,"data/%s.pcx",tname);
ihand=open(tname2,O_RDONLY);
if(ihand<0)
return 1;