aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-09-06 17:10:27 +0200
committerlonkaars <loek@pipeframe.xyz>2022-09-06 17:10:27 +0200
commit4a5325d3e0ef57dccca2bf935881975b30e4dc82 (patch)
tree7c7e78ccb282c20637205198b8302a3bce69fe09
parent9972f7abfc3b0b3381d7997c768f2342f9827dbb (diff)
new makefile
-rw-r--r--makefile22
1 files changed, 12 insertions, 10 deletions
diff --git a/makefile b/makefile
index 05077fe..4d538da 100644
--- a/makefile
+++ b/makefile
@@ -2,21 +2,23 @@ CC = gcc
LD = gcc
RM = rm -f
CFLAGS =
-EXECNAME = main
+LFLAGS =
+TARGET = main
-SOURCES := $(wildcard *.c)
-OBJECTS := $(patsubst %.c,%.o, $(SOURCES))
+SRCS := $(wildcard *.c)
+OBJS := $(patsubst %.c,%.o, $(SRCS))
all: main
-.o:
- $(CC) -c $(CFLAGS) $<
+%.o: %.c
+ $(CC) -c $(CFLAGS) $< -o $@
-$(EXECNAME): $(OBJECTS)
- $(CC) $(OBJECTS) -o $(EXECNAME)
+$(TARGET): $(OBJS)
+ $(LD) $^ $(LFLAGS) -o $@
clean:
- $(RM) $(EXECNAME)
+ $(RM) $(TARGET) $(OBJS)
+
+compile_commands: clean
+ compiledb make
-distclean: clean
- $(RM) *.o