aboutsummaryrefslogtreecommitdiff
path: root/Semestr 4/sieci/pracownia2/router/makefile
blob: bf6a327b8eb9aff6a5fb325b01e69b5d0189e290 (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		:= -O2 -std=gnu17 -Wall -Wall -Wno-unused-result
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