aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 36e7dcc014b059d908531aa98e2f9516a4ff6b6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
.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_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_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_force_feedback_max_concurrency.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_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

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

.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