summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e034e00
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,27 @@
+CC := gcc
+LD := $(CC)
+CFLAGS := -Os -std=c99 -Wall -Wextra -MMD $(shell sdl2-config --cflags)
+LDFLAGS := -lm $(shell sdl2-config --libs) -lSDL2_mixer
+SRC := $(wildcard *.c)
+OBJ := $(patsubst %.c,%.o,$(wildcard $(SRC)))
+DEP := $(patsubst %.o,%.d,$(wildcard $(OBJ)))
+NAME := musiclab
+
+all: $(NAME)
+
+$(NAME): $(OBJ)
+ $(LD) $(OBJ) -o $(NAME) $(LDFLAGS)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f $(NAME) $(OBJ) $(DEP)
+
+re:
+ make --no-print-directory clean
+ make --no-print-directory all
+
+.PHONY: all run clean re
+
+-include $(DEP)