diff --git a/Makefile b/Makefile
index 1c42120fc7..5450c47918 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,9 @@
include config.mk
-TARGET = ssnes
+TARGET = ssnes tools/ssnes-joyconfig
OBJ = ssnes.o file.o driver.o conf/config_file.o settings.o dynamic.o
+JOYCONFIG_OBJ = tools/ssnes-joyconfig.o conf/config_file.o
LIBS =
DEFINES = -DHAVE_CONFIG_H
@@ -85,6 +86,9 @@ config.mk: configure qb/*
ssnes: $(OBJ)
$(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
+tools/ssnes-joyconfig: $(JOYCONFIG_OBJ)
+ $(CC) -o $@ $(JOYCONFIG_OBJ) $(SDL_LIBS) $(LDFLAGS)
+
%.o: %.c config.h config.mk
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
@@ -92,8 +96,9 @@ install: $(TARGET)
install -m755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
install -m644 ssnes.cfg $(DESTDIR)/etc/ssnes.cfg
-uninstall: $(TARGET)
- rm -rf $(DESTDIR)/$(PREFIX)/bin/$(TARGET)
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/{ssnes,ssnes-joyconfig}
+ rm -f $(DESTDIR)/etc/ssnes.cfg
clean:
rm -f *.o
@@ -103,6 +108,7 @@ clean:
rm -f record/*.o
rm -f hqflt/*.o
rm -f hqflt/snes_ntsc/*.o
+ rm -f tools/*.o
rm -f $(TARGET)
.PHONY: all install uninstall clean
diff --git a/tools/ssnes-joyconfig.c b/tools/ssnes-joyconfig.c
index f6458df57d..bba3d1d455 100644
--- a/tools/ssnes-joyconfig.c
+++ b/tools/ssnes-joyconfig.c
@@ -15,6 +15,10 @@
* If not, see .
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#ifdef HAVE_SDL
#include "SDL.h"
#endif
@@ -24,6 +28,7 @@
#include
#include
+
static int g_player = 1;
static int g_joypad = 1;
static char *g_in_path = NULL;