aboutsummaryrefslogtreecommitdiff
path: root/Semestr 4/sieci/pracownia2/router/makefile
blob: 87bc15a8686104edfba83a8e57ad0817f4951a4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
CC				:= gcc
CFLAGS 		:= -Og -std=gnu17 -Wall -Wall -fsanitize=address -fsanitize=undefined
TARGET 		:= router
TEST 			:= test
DEPS			:= config.h

ODIR			:= obj
_OBJ	 		:= router.o utils.o linked_list.o network_addr.o dist_vector.o
OBJ				:= $(patsubst %,$(ODIR)/%,$(_OBJ))

_TEST_OBJ := test.o linked_list.o
TEST_OBJ  := $(patsubst %,$(ODIR)/%,$(_TEST_OBJ))


all: $(TARGET)
test: $(TEST)

$(ODIR)/%.o: %.c $(DEPS)
	$(CC) $(CFLAGS) -c -o $@ $<

$(TARGET): $(OBJ)
	$(CC) -o $@ $^ $(CFLAGS)

$(TEST): $(TEST_OBJ)
	$(CC) -o $@ $^ $(CFLAGS)

clean:
	rm -rf $(TARGET)
	rm -rf test

distclean:
	rm -rf $(TARGET)
	rm -rf test
	rm -rf $(ODIR)/*.o