42 lines
1.0 KiB
Makefile
42 lines
1.0 KiB
Makefile
CC := gcc -Wall -Wextra -Wpedantic -Iinclude -Isrc -g -std=c11
|
|
|
|
# pkg-config
|
|
# LIBS :=
|
|
# LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs $(LIBS))
|
|
# CFLAGS := $(CFLAGS) $(shell pkg-config --cflags $(LIBS))
|
|
|
|
CFLAGS := $(CFLAGS) -D_POSIX_C_SOURCE=200809L
|
|
|
|
OUT := test-ext-in test-ext-out test-iftun tunnel64d
|
|
|
|
SRC := $(wildcard src/*.c)
|
|
TEST := $(wildcard test/*.c)
|
|
OBJS := $(patsubst src/%.c,build/%.o,$(SRC))
|
|
TEST_OBJS := $(patsubst test/%.c,build/test-%.o,$(TEST))
|
|
DEPS := $(wildcard build/*.d)
|
|
|
|
|
|
.PHONY: all
|
|
all: test-ext-in test-ext-out test-iftun tunnel64d
|
|
|
|
$(OUT):
|
|
$(CC) $(LDFLAGS) -o $@ $^
|
|
|
|
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
|
|
|
|
-include $(DEPS)
|
|
build/test-%.o: test/%.c
|
|
$(CC) $(CFLAGS) -MP -MD $< -c -o $@
|
|
build/%.o: src/%.c
|
|
$(CC) $(CFLAGS) -MP -MD $< -c -o $@
|
|
|
|
|
|
clean:
|
|
-rm -f build/*.o
|
|
-rm -f build/*.d
|
|
-rm -f $(OUT)
|