50 lines
912 B
Makefile
50 lines
912 B
Makefile
.PHONY : clean tests all manual
|
|
|
|
CFLAGS = -std=c99 -Iinclude -pedantic
|
|
WARNINGS= -Wall -Wextra
|
|
LDFLAGS = -fPIC -shared
|
|
MACROS= -D_POSIX_C_SOURCE=1
|
|
|
|
TARGET = libflint.so
|
|
SRC != ls src/*.c
|
|
OBJ = $(SRC:./src/$.c=./obj/%.o)
|
|
|
|
PREFIX = $(DESTDIR)/usr/local
|
|
LIBDIR = $(PREFIX)/lib
|
|
|
|
OS_NAME != uname -s | tr A-Z a-z
|
|
|
|
all: $(TARGET)
|
|
./clanggen.sh
|
|
|
|
$(TARGET): $(OBJ)
|
|
ifeq ($(OS_NAME),"openbsd")
|
|
@echo "Building for openbsd"
|
|
endif
|
|
cc $(CFLAGS) $(WARNINGS) $(LDFLAGS) -o $(TARGET) $(OBJ)
|
|
|
|
./obj/%.o: ./src/%.c
|
|
cc $(CFLAGS) -c $< -o $@
|
|
|
|
install: $(TARGET)
|
|
cp $(TARGET) $(LIBDIR)
|
|
|
|
uninstall:
|
|
rm -f $(LIBDIR)/$(TARGET)
|
|
|
|
clean:
|
|
rm -f $(TARGET)
|
|
rm -f testrunner
|
|
rm -f tcptest
|
|
rm -f netmanual
|
|
rm -f compile_commands.json
|
|
|
|
tests:
|
|
cc $(CFLAGS) -o testrunner tests/tests.c src/*.c
|
|
cc $(CFLAGS) -o tcptest tests/tcptest.c src/*.c
|
|
./run_tests.sh
|
|
|
|
manual:
|
|
cc $(CFLAGS) -o netmanual tests/netmanual.c src/*.c
|
|
|