I now start the listener in the main.c file rather than proxy given that I didn't feel proxy was the right place if a normal (non-proxied) request came in. webserver.{c,h} and proxy.{c,h} had some changes relating to this. The config changed slightly - we now create a folder in ~/.config/ called yaip. This is where certificates and so on will be stored along with the user configuration I created a helper function to get files inside this directory (it changes based on xdg_config_home) and updated relevant tests. In ssl.{c,h} I have started work. If they don't exist, the tool now creates and stores a key and certificate for the CA that this tool will need to pretend to be. I still need to write tests for this.
37 lines
658 B
Makefile
37 lines
658 B
Makefile
# This was stolen from here: https://avikdas.com/2019/12/16/makefiles-for-c-cpp-projects.html
|
|
|
|
CFILES = $(wildcard src/*.c)
|
|
OBJFILES = $(CFILES:.c=.o)
|
|
TESTFILES = $(wildcard tests/*.c)
|
|
TESTOUT = $(TESTFILES:.c=)
|
|
OUT = yaip
|
|
CFLAGS = -Wall -g
|
|
LDLIBS = -lsqlite3 -lm -lssl -lcrypto
|
|
CC = gcc
|
|
|
|
|
|
.PHONY: default
|
|
default: $(OUT)
|
|
|
|
|
|
.PHONY: run
|
|
run: $(OUT)
|
|
./$(OUT)
|
|
|
|
$(OUT): $(OBJFILES)
|
|
$(CC) -o $@ $^ $(LDLIBS)
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c -o $@ $^
|
|
|
|
tests/%.test: tests/%.test.c tests/munit/munit.c $(filter-out src/main.o, $(OBJFILES))
|
|
$(CC) -o $@ $^ $(LDLIBS)
|
|
|
|
|
|
test-%: tests/%.test
|
|
$<
|
|
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f $(OBJFILES) $(OUT) $(TESTOUT)
|