aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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