blob: 910c1c2a605a4c3c7d34d1a0e55ea7687e6e157d (
plain) (
tree)
|
|
.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_absolute_axis_names__.o\
libgamepad_button_names__.o\
libgamepad_close_device.o\
libgamepad_close_superdevice.o\
libgamepad_construct_constant_force_feedback_effect.o\
libgamepad_construct_damper_force_feedback_effect.o\
libgamepad_construct_force_feedback_effect__.o\
libgamepad_construct_friction_force_feedback_effect.o\
libgamepad_construct_inertia_force_feedback_effect.o\
libgamepad_construct_periodic_force_feedback_effect.o\
libgamepad_construct_ramp_force_feedback_effect.o\
libgamepad_construct_rumble_force_feedback_effect.o\
libgamepad_construct_spring_force_feedback_effect.o\
libgamepad_create_attachment_monitor.o\
libgamepad_destroy_attachment_monitor.o\
libgamepad_disable_force_feedback_autocenter.o\
libgamepad_find_sound_devices.o\
libgamepad_get_absolute_axis_by_name.o\
libgamepad_get_absolute_axis_info.o\
libgamepad_get_absolute_axis_name.o\
libgamepad_get_attachment_event.o\
libgamepad_get_button_by_name.o\
libgamepad_get_button_is_pressed.o\
libgamepad_get_button_name.o\
libgamepad_get_force_feedback_max_concurrency.o\
libgamepad_get_relative_axis_by_name.o\
libgamepad_get_relative_axis_name.o\
libgamepad_grab.o\
libgamepad_install_force_feedback_effect.o\
libgamepad_is_force_feedback_effect_supported.o\
libgamepad_list_superdevices.o\
libgamepad_next_event.o\
libgamepad_open_device.o\
libgamepad_open_superdevice.o\
libgamepad_play_force_feedback_effect.o\
libgamepad_relative_axis_names__.o\
libgamepad_set_clock.o\
libgamepad_set_force_feedback_autocenter.o\
libgamepad_set_force_feedback_master_gain.o\
libgamepad_stop_force_feedback_effect.o\
libgamepad_ungrab.o\
libgamepad_uninstall_force_feedback_effect.o\
libgamepad_update_force_feedback_effect.o
HDR =\
common.h\
libgamepad.h\
button.count\
absolute-axis.count\
relative-axis.count
TESTS =\
test-attachments\
test-details\
test-input\
test-list\
test-visual
LOBJ = $(OBJ:.o=.lo)
all: libgamepad.a libgamepad.$(LIBEXT) $(TESTS)
$(OBJ): $(HDR)
$(LOBJ): $(HDR)
$(TESTS:=.o): $(HDR)
$(TESTS): libgamepad.a
libgamepad_button_names__.o: button.names
libgamepad_absolute_axis_names__.o: absolute-axis.names
libgamepad_relative_axis_names__.o: relative-axis.names
button.names: names.sh
printf '%s\n' '#include <linux/input.h>' | $(CPP) -dM | ./names.sh BTN KEY > $@
absolute-axis.names: names.sh
printf '%s\n' '#include <linux/input.h>' | $(CPP) -dM | ./names.sh ABS > $@
relative-axis.names: names.sh
printf '%s\n' '#include <linux/input.h>' | $(CPP) -dM | ./names.sh REL > $@
.names.count:
wc -l < $< > $@
.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 *.names *.count
-rm -f -- *.gch *.gcov *.gcno *.gcda *.$(LIBEXT) $(TESTS)
.SUFFIXES:
.SUFFIXES: .lo .o .c .names .count
.PHONY: all install uninstall clean
|