summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c4f2d14
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+CC := gcc
+LD := $(CC)
+SRC := $(wildcard *.c)
+OBJ := $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SRC)))
+NAME := restruct
+CFLAGS := -Wall -Wextra -std=c99 -pedantic
+LDFLAGS :=
+
+all: $(NAME)
+
+$(NAME): $(OBJ)
+ @printf '[ld] *.o -> %s\n' "$(NAME)"
+ @$(LD) -o $(NAME) $(OBJ) $(LDFLAGS)
+
+%.o: %.c
+ @printf '[cc] %s -> %s\n' "$<" "$@"
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+clean:
+ @printf '[rm]\n'
+ @rm -rf $(NAME) $(OBJ)
+
+run: $(NAME)
+ @printf '[run]\n'
+ @./$(NAME)
+
+re:
+ @printf '[re]\n'
+ @make --no-print-directory clean
+ @make --no-print-directory
+
+.PHONY: all clean run re