2019-11-13 11:10:05 +01:00
|
|
|
CC := gcc -Wall -Wextra -Wpedantic -Werror -Wshadow=local -Iinclude -Isrc -g -std=c11
|
2019-10-25 11:37:27 +02:00
|
|
|
|
2019-11-13 11:10:05 +01:00
|
|
|
# pkg-config
|
|
|
|
# LIBS :=
|
|
|
|
# LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs $(LIBS))
|
|
|
|
# CFLAGS := $(CFLAGS) $(shell pkg-config --cflags $(LIBS))
|
2019-10-25 11:37:27 +02:00
|
|
|
|
2019-11-06 07:36:00 +01:00
|
|
|
CFLAGS := $(CFLAGS) -D_POSIX_C_SOURCE=200809L
|
2019-10-25 11:37:27 +02:00
|
|
|
|
2019-11-13 12:55:45 +01:00
|
|
|
OUT := test-ext-in test-ext-out test-iftun tunnel64d
|
2019-10-25 23:53:43 +02:00
|
|
|
|
2019-11-06 07:36:00 +01:00
|
|
|
SRC := $(wildcard src/*.c)
|
2019-11-13 11:10:05 +01:00
|
|
|
TEST := $(wildcard test/*.c)
|
|
|
|
OBJS := $(patsubst src/%.c,build/%.o,$(SRC))
|
|
|
|
TEST_OBJS := $(patsubst test/%.c,build/test-%.o,$(TEST))
|
|
|
|
DEPS := $(wildcard build/*.d)
|
2019-10-25 23:53:43 +02:00
|
|
|
|
|
|
|
|
2019-11-13 12:55:45 +01:00
|
|
|
.PHONY: all
|
|
|
|
all: test-ext-in test-ext-out test-iftun tunnel64d
|
2019-10-25 23:53:43 +02:00
|
|
|
|
2019-11-13 11:10:05 +01:00
|
|
|
$(OUT):
|
2019-11-06 07:36:00 +01:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $^
|
2019-10-25 23:53:43 +02:00
|
|
|
|
2019-11-13 11:10:05 +01:00
|
|
|
test-ext-in: build/test-ext-in.o build/extremite.o build/iftun.o
|
|
|
|
test-ext-out: build/test-ext-out.o build/extremite.o build/iftun.o
|
|
|
|
test-iftun: build/test-iftun.o build/iftun.o
|
|
|
|
|
|
|
|
tunnel64d: build/tunnel64d.o build/extremite.o build/iftun.o
|
2019-10-25 11:37:27 +02:00
|
|
|
|
2019-11-06 07:36:00 +01:00
|
|
|
-include $(DEPS)
|
2019-11-13 11:10:05 +01:00
|
|
|
build/test-%.o: test/%.c
|
|
|
|
$(CC) $(CFLAGS) -MP -MD $< -c -o $@
|
|
|
|
build/%.o: src/%.c
|
2019-11-06 07:36:00 +01:00
|
|
|
$(CC) $(CFLAGS) -MP -MD $< -c -o $@
|
2019-10-25 11:37:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
clean:
|
2019-11-13 11:10:05 +01:00
|
|
|
-rm -f build/*.o
|
|
|
|
-rm -f build/*.d
|
2019-11-13 12:55:45 +01:00
|
|
|
-rm -f $(OUT)
|