diff --git a/Makefile b/Makefile index 20c324c..6b8138e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -SUBDIRS = src/sdl-instead stead games themes icon desktop doc languages +include Rules.make + +SUBDIRS = src/sdl-instead stead games themes icon desktop doc languages all: @for dir in $(SUBDIRS); do \ @@ -11,8 +13,20 @@ clean: done; install: all +ifeq ($(SYSTEMSETUP), yes) @for dir in $(SUBDIRS); do \ $(MAKE) -C $$dir install || exit 1; \ done; +else + echo No install needed +endif - +uninstall: +ifeq ($(SYSTEMSETUP), yes) + @for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir uninstall || exit 1; \ + done; + $(RM) -rf $(STEADPATH) +else + echo No uninstall needed +endif diff --git a/Rules.make.standalone b/Rules.make.standalone index c2832d7..88b5292 100644 --- a/Rules.make.standalone +++ b/Rules.make.standalone @@ -9,14 +9,15 @@ ICONPATH=./icon LANGPATH=./languages DOCPATH= MANPATH= +SYSTEMSETUP=no LUA_CFLAGS=$(shell pkg-config --cflags lua5.1) LUA_LFLAGS=$(shell pkg-config --libs lua5.1) # for arch linux, fedora (may be others) use this # -# LUA_CFLAGS=$(shell pkg-config --cflags lua) -# LUA_LFLAGS=$(shell pkg-config --libs lua) +LUA_CFLAGS=$(shell pkg-config --cflags lua) +LUA_LFLAGS=$(shell pkg-config --libs lua) # SDL_CFLAGS=$(shell sdl-config --cflags) @@ -24,9 +25,11 @@ SDL_LFLAGS=$(shell sdl-config --libs) -lSDL_ttf -lSDL_mixer -lSDL_image CFLAGS += -g -Wall -D_HAVE_ICONV -INSTALLD=echo -INSTALL=echo -EXE= +INSTALLD=echo "Do not install standalone version!" +INSTALLB=echo "Do not install standalone version!" +INSTALL=echo "Do not install standalone version!" +EXE= PLATFORM=unix.c RESOURCES= +RM=rm diff --git a/Rules.make.system b/Rules.make.system index 34ede62..524272e 100644 --- a/Rules.make.system +++ b/Rules.make.system @@ -10,6 +10,7 @@ ICONPATH=$(DESTDIR)$(PREFIX)/share/pixmaps DOCPATH=$(DESTDIR)$(PREFIX)/share/doc/instead LANGPATH=$(STEADPATH)/languages MANPATH=$(DESTDIR)$(PREFIX)/share/man/man6 +SYSTEMSETUP=yes LUA_CFLAGS=$(shell pkg-config --cflags lua5.1) LUA_LFLAGS=$(shell pkg-config --libs lua5.1) @@ -26,8 +27,10 @@ SDL_LFLAGS=$(shell sdl-config --libs) -lSDL_ttf -lSDL_mixer -lSDL_image CFLAGS += -Wall -D_HAVE_ICONV INSTALLD=install -d -m 0755 -INSTALL=install -m 0755 +INSTALLB=install -m 0755 +INSTALL=install -m 0644 + EXE= PLATFORM=unix.c RESOURCES= - +RM=rm diff --git a/desktop/Makefile b/desktop/Makefile index 8403da7..bf8368f 100644 --- a/desktop/Makefile +++ b/desktop/Makefile @@ -8,6 +8,12 @@ instead.desktop: instead.desktop.in cat instead.desktop.in | sed -e "s|@BIN|$(BIN)|g" > instead.desktop install: - install -d -m 0755 $(DESTDIR)$(PREFIX)/share/applications - install -m 0644 instead.desktop $(DESTDIR)$(PREFIX)/share/applications/instead.desktop + $(INSTALLD) $(DESTDIR)$(PREFIX)/share/applications + $(INSTALL) instead.desktop $(DESTDIR)$(PREFIX)/share/applications/instead.desktop +ifeq ($(SYSTEMSETUP), yes) +uninstall: + $(RM) $(DESTDIR)$(PREFIX)/share/applications/instead.desktop +else +uninstall: +endif diff --git a/doc/Makefile b/doc/Makefile index a135f60..c424c7f 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -2,7 +2,15 @@ include ../Rules.make clean: all: install: - install -d -m0755 $(DOCPATH) - install -m0644 *.jpg *.html *.txt $(DOCPATH) - install -d -m0755 $(MANPATH) - install -m0644 *.6 $(MANPATH) + $(INSTALLD) $(DOCPATH) + $(INSTALL) *.jpg *.html *.txt $(DOCPATH) + $(INSTALLD) $(MANPATH) + $(INSTALL) *.6 $(MANPATH) + +ifeq ($(SYSTEMSETUP), yes) +uninstall: + $(RM) -rf $(DOCPATH) + $(RM) $(MANPATH)/instead.* +else +uninstall: +endif diff --git a/games/Makefile b/games/Makefile index 28b1e40..d960a47 100644 --- a/games/Makefile +++ b/games/Makefile @@ -1,10 +1,20 @@ include ../Rules.make all: install: - install -d -m0755 $(GAMESPATH) +ifeq ($(SYSTEMSETUP), yes) + $(INSTALLD) $(GAMESPATH) for f in *; do \ if [ ! -d $$f ]; then continue; fi;\ - install -d -m0755 $(GAMESPATH)/$$f;\ + $(INSTALLD) $(GAMESPATH)/$$f; \ tar --exclude=".svn" -c -C $$f . | tar -x -C $(GAMESPATH)/$$f;\ done +endif + +ifeq ($(SYSTEMSETUP), yes) +uninstall: + $(RM) -rf $(GAMESPATH) +else +uninstall: +endif + clean: diff --git a/icon/Makefile b/icon/Makefile index dcdf8b7..c5494b7 100644 --- a/icon/Makefile +++ b/icon/Makefile @@ -2,6 +2,12 @@ include ../Rules.make clean: all: install: - install -d -m0755 $(ICONPATH) - install -m0644 sdl_instead.png $(ICONPATH) + $(INSTALLD) $(ICONPATH) + $(INSTALL) sdl_instead.png $(ICONPATH) +ifeq ($(SYSTEMSETUP), yes) +uninstall: + $(RM) $(ICONPATH)/sdl_instead.png +else +uninstall: +endif diff --git a/languages/Makefile b/languages/Makefile index 3d03e55..06b99e5 100644 --- a/languages/Makefile +++ b/languages/Makefile @@ -2,7 +2,14 @@ include ../Rules.make clean: all: install: - install -d -m0755 $(LANGPATH) + $(INSTALLD) $(LANGPATH) for f in *.ini; do \ - install -m0644 $$f $(LANGPATH)/$$f;\ + $(INSTALL) $$f $(LANGPATH)/$$f;\ done + +ifeq ($(SYSTEMSETUP), yes) +uninstall: + $(RM) -rf $(LANGPATH) +else +uninstall: +endif diff --git a/src/instead/Makefile b/src/instead/Makefile index ddce230..e10e6aa 100644 --- a/src/instead/Makefile +++ b/src/instead/Makefile @@ -4,8 +4,14 @@ all: instead instead: instead.c rline.c $(CC) $(CFLAGS) -DSTEAD_PATH=\"${STEADPATH}/\" instead.c $(LUA_CFLAGS) rline.c $(LUA_LFLAGS) -lncurses -lreadline -o instead clean: - rm -rf *.o instead + $(RM) -rf *.o instead install: - install -d -m 0755 $(BIN) - install -m 0755 instead $(BIN)/instead + $(INSTALLD) $(BIN) + $(INSTALLB) instead $(BIN)/instead +ifeq ($(SYSTEMSETUP), yes) +uninstall: + $(RM) $(BIN)/instead +else +uninstall: +endif diff --git a/src/sdl-instead/Makefile b/src/sdl-instead/Makefile index 39d6069..3111518 100644 --- a/src/sdl-instead/Makefile +++ b/src/sdl-instead/Makefile @@ -18,7 +18,14 @@ sdl-instead$(EXE): $(OBJ) $(RESOURCES) install: $(INSTALLD) $(BIN) - $(INSTALL) sdl-instead$(EXE) $(BIN)/sdl-instead$(EXE) + $(INSTALLB) sdl-instead$(EXE) $(BIN)/sdl-instead$(EXE) + +ifeq ($(SYSTEMSETUP), yes) +uninstall: + $(RM) $(BIN)/sdl-instead$(EXE) +else +uninstall: +endif clean: $(RM) -f *.o sdl-instead$(EXE) diff --git a/stead/Makefile b/stead/Makefile index e05d59a..4c5bf1c 100644 --- a/stead/Makefile +++ b/stead/Makefile @@ -3,7 +3,14 @@ clean: all: stead.lua install: - install -m 0755 -d $(STEADPATH) - install -m 0644 stead.lua $(STEADPATH)/stead.lua - install -m 0644 gui.lua $(STEADPATH)/gui.lua + $(INSTALLD) $(STEADPATH) + $(INSTALL) stead.lua $(STEADPATH)/stead.lua + $(INSTALL) gui.lua $(STEADPATH)/gui.lua +ifeq ($(SYSTEMSETUP), yes) +uninstall: + $(RM) $(STEADPATH)/stead.lua + $(RM) $(STEADPATH)/gui.lua +else +uninstall: +endif diff --git a/themes/Makefile b/themes/Makefile index ce1216f..905bc72 100644 --- a/themes/Makefile +++ b/themes/Makefile @@ -2,10 +2,18 @@ include ../Rules.make clean: all: install: - install -d -m0755 $(THEMESPATH) +ifeq ($(SYSTEMSETUP), yes) + $(INSTALLD) $(THEMESPATH) for f in *; do \ if [ ! -d $$f ]; then continue; fi;\ - install -d -m0755 $(THEMESPATH)/$$f;\ + $(INSTALLD) $(THEMESPATH)/$$f;\ tar --exclude=".svn" -c -C $$f . | tar -x -C $(THEMESPATH)/$$f;\ done +endif +ifeq ($(SYSTEMSETUP), yes) +uninstall: + $(RM) -rf $(THEMESPATH) +else +uninstall: +endif