diff --git a/.gitignore b/.gitignore index 1c0ae5a8..89fc86d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *~ .vscode +/misc/examples/**/*.o /misc/examples/c_directional_rumble_test/direction_rumble_test /misc/examples/c_hidraw/hidraw docs/_site/** diff --git a/misc/examples/c_hidraw/Makefile b/misc/examples/c_hidraw/Makefile index 8146a2df..420a358e 100644 --- a/misc/examples/c_hidraw/Makefile +++ b/misc/examples/c_hidraw/Makefile @@ -1,4 +1,21 @@ -CFLAGS = $(shell pkg-config ncurses --cflags) -LDFLAGS = $(shell pkg-config ncurses --libs) +PROGRAM = hidraw -all: hidraw +CFLAGS += $(shell pkg-config ncurses --cflags) +LDFLAGS += $(shell pkg-config ncurses --libs) + +SRC = hidraw.c + +OBJ = $(SRC:.c=.o) + +.PHONY: all clean + +all: $(PROGRAM) + +$(PROGRAM): $(OBJ) + $(CC) $< $(LDFLAGS) -o $@ + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +clean: + rm -f $(PROGRAM) $(OBJ)