diff options
author | Franciszek Malinka <franciszek.malinka@gmail.com> | 2021-04-19 10:01:37 +0200 |
---|---|---|
committer | Franciszek Malinka <franciszek.malinka@gmail.com> | 2021-04-19 10:01:37 +0200 |
commit | ce16e5dfa3939f74e75bf80ff97c992ae661c7cc (patch) | |
tree | ec37affaa660e74740776721c1e8d82e2b23e2db /Semestr 4/sieci/pracownia2/router/makefile | |
parent | 7bb11482a54c78123f11d81c698a9b48ef48d5d9 (diff) |
Better makefile and project structure
Diffstat (limited to 'Semestr 4/sieci/pracownia2/router/makefile')
-rw-r--r-- | Semestr 4/sieci/pracownia2/router/makefile | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/Semestr 4/sieci/pracownia2/router/makefile b/Semestr 4/sieci/pracownia2/router/makefile index be41840..7d8aaef 100644 --- a/Semestr 4/sieci/pracownia2/router/makefile +++ b/Semestr 4/sieci/pracownia2/router/makefile @@ -1,30 +1,19 @@ -CC := gcc -CFLAGS := -Og -std=gnu17 -Wall -Wall -fsanitize=address -fsanitize=undefined -TARGET := router +CC := gcc +CFLAGS := -Og -std=gnu17 -Wall -Wall -fsanitize=address -fsanitize=undefined +TARGET := router +DEPS := config.h -all: $(TARGET) -test: test - -utils.o: utils.c - $(CC) $(CFLAGS) -c utils.c - -network_addr.o: network_addr.c - $(CC) $(CFLAGS) -c network_addr.c +ODIR := obj +_OBJ := router.o utils.o linked_list.o network_addr.o dist_vector.o +OBJ := $(patsubst %,$(ODIR)/%,$(_OBJ)) -router.o: router.c - $(CC) $(CFLAGS) -c $(TARGET).c - -linked_list.o: linked_list.c - $(CC) $(CFLAGS) -c linked_list.c - -router: utils.o network_addr.o linked_list.o router.o - $(CC) $(CFLAGS) -o $(TARGET) $(TARGET).o network_addr.o utils.o linked_list.o +all: $(TARGET) -test.o: test.c - $(CC) $(CFLAGS) -c test.c +$(ODIR)/%.o: %.c $(DEPS) + $(CC) $(CFLAGS) -c -o $@ $< -test: linked_list.o test.o - $(CC) $(CFLAGS) -o test test.o linked_list.o +$(TARGET): $(OBJ) + $(CC) -o $@ $^ $(CFLAGS) clean: rm -rf $(TARGET) @@ -33,4 +22,4 @@ clean: distclean: rm -rf $(TARGET) rm -rf test - rm -rf *.o + rm -rf $(ODIR)/*.o |