diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0ccc316 --- /dev/null +++ b/Makefile @@ -0,0 +1,98 @@ +.POSIX: + +CONFIGFILE = config.mk +include $(CONFIGFILE) + +OS = linux +# Linux: linux +# Mac OS: macos +# Windows: windows +include mk/$(OS).mk + + +LIB_MAJOR = 1 +LIB_MINOR = 0 +LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR) +LIB_NAME = gamepad + + +OBJ =\ + libgamepad_close_device.o\ + libgamepad_close_superdevice.o\ + libgamepad_create_attachment_monitor.o\ + libgamepad_destroy_attachment_monitor.o\ + libgamepad_get_absolute_axis_info.o\ + libgamepad_get_absolute_axis_name.o\ + libgamepad_get_attachment_event.o\ + libgamepad_get_button_is_pressed.o\ + libgamepad_get_button_name.o\ + libgamepad_get_relative_axis_name.o\ + libgamepad_grab.o\ + libgamepad_list_superdevices.o\ + libgamepad_next_event.o\ + libgamepad_open_device.o\ + libgamepad_open_superdevice.o\ + libgamepad_set_clock.o\ + libgamepad_ungrab.o + +HDR =\ + common.h\ + libgamepad.h + +TESTS =\ + test-attachments\ + test-details\ + test-input\ + test-list + +LOBJ = $(OBJ:.o=.lo) + + +all: libgamepad.a libgamepad.$(LIBEXT) $(TESTS) +$(OBJ): $(HDR) +$(LOBJ): $(HDR) +$(TESTS:=.o): $(HDR) +$(TESTS): libgamepad.a + +.c.o: + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) $(LIBS_CFLAGS) + +.c.lo: + $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS) $(LIBS_CFLAGS) + +.o: + $(CC) -o $@ $< libgamepad.a $(LDFLAGS) $(LIBS_LDFLAGS) + +libgamepad.a: $(OBJ) + @rm -f -- $@ + $(AR) rc $@ $(OBJ) + $(AR) ts $@ > /dev/null + +libgamepad.$(LIBEXT): $(LOBJ) + $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) $(LIBS_LDFLAGS) + +install: libgamepad.a libgamepad.$(LIBEXT) + mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" + mkdir -p -- "$(DESTDIR)$(PREFIX)/include" + cp -- libgamepad.a "$(DESTDIR)$(PREFIX)/lib/" + cp -- libgamepad.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libgamepad.$(LIBMINOREXT)" + $(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libgamepad.$(LIBMINOREXT)" + ln -sf -- libgamepad.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libgamepad.$(LIBMAJOREXT)" + ln -sf -- libgamepad.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libgamepad.$(LIBEXT)" + cp -- libgamepad.h "$(DESTDIR)$(PREFIX)/include/" + +uninstall: + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgamepad.a" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgamepad.$(LIBMAJOREXT)" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgamepad.$(LIBMINOREXT)" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgamepad.$(LIBEXT)" + -rm -f -- "$(DESTDIR)$(PREFIX)/include/libgamepad.h" + +clean: + -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib + -rm -f -- *.gch *.gcov *.gcno *.gcda *.$(LIBEXT) $(TESTS) + +.SUFFIXES: +.SUFFIXES: .lo .o .c + +.PHONY: all install uninstall clean |