diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-09-06 17:10:27 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-09-06 17:10:27 +0200 |
commit | 4a5325d3e0ef57dccca2bf935881975b30e4dc82 (patch) | |
tree | 7c7e78ccb282c20637205198b8302a3bce69fe09 | |
parent | 9972f7abfc3b0b3381d7997c768f2342f9827dbb (diff) |
new makefile
-rw-r--r-- | makefile | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -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 |