diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-03 11:06:28 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-03 11:06:28 +0200 |
commit | 49c81f56b9262a41335f36a727c8125e349b1487 (patch) | |
tree | 7cbe1696f83f18cec5fe861daa8204767cd5587a | |
parent | 6cda6a35647b5faad8914b66f277e5bf645bbfd2 (diff) |
no more duplicate makefiles
-rw-r--r-- | makefile | 8 | ||||
l---------[-rw-r--r--] | week-1/makefile | 23 | ||||
l---------[-rw-r--r--] | week-2/makefile | 25 | ||||
l---------[-rw-r--r--] | week-3/makefile | 25 | ||||
l---------[-rw-r--r--] | week-4/makefile | 25 | ||||
l---------[-rw-r--r--] | week-5/makefile | 25 | ||||
l---------[-rw-r--r--] | week-6/makefile | 25 | ||||
-rw-r--r-- | week.mk | 24 |
8 files changed, 38 insertions, 142 deletions
diff --git a/makefile b/makefile new file mode 100644 index 0000000..71eabae --- /dev/null +++ b/makefile @@ -0,0 +1,8 @@ +MK = make -j +WEKEN = $(wildcard week-*) + +all: + $(foreach WEEK,$(WEKEN), $(MK) -C $(WEEK);) + +clean: + $(foreach WEEK,$(WEKEN), $(MK) -C $(WEEK) clean;) diff --git a/week-1/makefile b/week-1/makefile index 8ab5b1c..a4e84c6 100644..120000 --- a/week-1/makefile +++ b/week-1/makefile @@ -1,22 +1 @@ -CC = g++ -LD = g++ -RM = rm -f -CFLAGS = -EXECNAME = main - -SOURCES := $(wildcard *.cpp) -OBJECTS := $(patsubst %.cpp,%.o, $(SOURCES)) - -all: main - -.o: - $(CC) -c $(CFLAGS) $< - -$(EXECNAME): $(OBJECTS) - $(CC) $(OBJECTS) -o $(EXECNAME) - -clean: - $(RM) $(EXECNAME) - -distclean: clean - $(RM) *.o +../week.mk
\ No newline at end of file diff --git a/week-2/makefile b/week-2/makefile index 3b71b5b..a4e84c6 100644..120000 --- a/week-2/makefile +++ b/week-2/makefile @@ -1,24 +1 @@ -CC = gcc -LD = gcc -RM = rm -f -TARGET = main - -LFLAGS += -lstdc++ - -SRCS := $(wildcard *.cpp) -OBJS := $(patsubst %.cpp,%.o, $(SRCS)) - -all: main - -%.o: %.cpp - $(CC) -c $(CFLAGS) $< -o $@ - -$(TARGET): $(OBJS) - $(LD) $^ $(LFLAGS) -o $@ - -clean: - $(RM) $(TARGET) $(OBJS) - -compile_commands: clean - compiledb make - +../week.mk
\ No newline at end of file diff --git a/week-3/makefile b/week-3/makefile index 3b71b5b..a4e84c6 100644..120000 --- a/week-3/makefile +++ b/week-3/makefile @@ -1,24 +1 @@ -CC = gcc -LD = gcc -RM = rm -f -TARGET = main - -LFLAGS += -lstdc++ - -SRCS := $(wildcard *.cpp) -OBJS := $(patsubst %.cpp,%.o, $(SRCS)) - -all: main - -%.o: %.cpp - $(CC) -c $(CFLAGS) $< -o $@ - -$(TARGET): $(OBJS) - $(LD) $^ $(LFLAGS) -o $@ - -clean: - $(RM) $(TARGET) $(OBJS) - -compile_commands: clean - compiledb make - +../week.mk
\ No newline at end of file diff --git a/week-4/makefile b/week-4/makefile index 3b71b5b..a4e84c6 100644..120000 --- a/week-4/makefile +++ b/week-4/makefile @@ -1,24 +1 @@ -CC = gcc -LD = gcc -RM = rm -f -TARGET = main - -LFLAGS += -lstdc++ - -SRCS := $(wildcard *.cpp) -OBJS := $(patsubst %.cpp,%.o, $(SRCS)) - -all: main - -%.o: %.cpp - $(CC) -c $(CFLAGS) $< -o $@ - -$(TARGET): $(OBJS) - $(LD) $^ $(LFLAGS) -o $@ - -clean: - $(RM) $(TARGET) $(OBJS) - -compile_commands: clean - compiledb make - +../week.mk
\ No newline at end of file diff --git a/week-5/makefile b/week-5/makefile index 3b71b5b..a4e84c6 100644..120000 --- a/week-5/makefile +++ b/week-5/makefile @@ -1,24 +1 @@ -CC = gcc -LD = gcc -RM = rm -f -TARGET = main - -LFLAGS += -lstdc++ - -SRCS := $(wildcard *.cpp) -OBJS := $(patsubst %.cpp,%.o, $(SRCS)) - -all: main - -%.o: %.cpp - $(CC) -c $(CFLAGS) $< -o $@ - -$(TARGET): $(OBJS) - $(LD) $^ $(LFLAGS) -o $@ - -clean: - $(RM) $(TARGET) $(OBJS) - -compile_commands: clean - compiledb make - +../week.mk
\ No newline at end of file diff --git a/week-6/makefile b/week-6/makefile index 3b71b5b..a4e84c6 100644..120000 --- a/week-6/makefile +++ b/week-6/makefile @@ -1,24 +1 @@ -CC = gcc -LD = gcc -RM = rm -f -TARGET = main - -LFLAGS += -lstdc++ - -SRCS := $(wildcard *.cpp) -OBJS := $(patsubst %.cpp,%.o, $(SRCS)) - -all: main - -%.o: %.cpp - $(CC) -c $(CFLAGS) $< -o $@ - -$(TARGET): $(OBJS) - $(LD) $^ $(LFLAGS) -o $@ - -clean: - $(RM) $(TARGET) $(OBJS) - -compile_commands: clean - compiledb make - +../week.mk
\ No newline at end of file @@ -0,0 +1,24 @@ +CC = g++ +LD = g++ +RM = rm -f +TARGET = main + +LFLAGS += -lstdc++ + +SRCS := $(wildcard *.cpp) +OBJS := $(patsubst %.cpp,%.o, $(SRCS)) + +all: main + +%.o: %.cpp + $(CC) -c $(CFLAGS) $< -o $@ + +$(TARGET): $(OBJS) + $(LD) $^ $(LFLAGS) -o $@ + +clean: + $(RM) $(TARGET) $(OBJS) + +compile_commands: clean + compiledb make + |