update Makefile

This commit is contained in:
j3d1 2019-03-28 11:39:24 +01:00
parent 56affbe423
commit 21e6c2b407

View file

@ -1,22 +1,42 @@
CC = g++ CC = gcc
LINKER = g++ CXX = g++
CFLAGS = -std=c++14 -Wall -Werror -Wpointer-arith -Wfatal-errors LD = g++
CXXFLAGS = -std=c++17 -Wall -Werror -Wpointer-arith -Wfatal-errors
CFLAGS = -Wall -Werror -Wpointer-arith -Wfatal-errors
DEBUG = -g DEBUG = -g
prefix=/usr/local prefix=/usr/local
all: shepherd OBJECTS = build/memdb.o build/spmemvfs.o build/crypto.o build/Manager.o build/Database.o
shepherd: src/*.cpp src/*.h all: build/shepherd build/test
mkdir -p bin
$(CC) $(CFLAGS) src/*.cpp -o bin/shepherd -lsqlite3 build/shepherd: build/shepherd.o $(OBJECTS)
@mkdir -p $(dir $@)
@echo "\n->"$@
@$(LD) $(CXXFLAGS) $^ -o $@ -lsqlite3 -lsodium -lstdc++fs
build/test: build/testmemvfs.o $(OBJECTS)
@mkdir -p $(dir $@)
@echo "\n->"$@
@$(LD) $(CXXFLAGS) $^ -o $@ -lsqlite3 -lsodium -lstdc++fs
build/%.o: src/%.cpp src/%.h
@mkdir -p $(dir $@)
@echo -n $@" "
@$(CXX) $(CXXFLAGS) -c -o $@ $<
build/%.o: src/%.c src/%.h
@mkdir -p $(dir $@)
@echo -n $@" "
@$(CC) $(CFLAGS) -c -o $@ $<
rsa: rsa.cpp rsa: rsa.cpp
mkdir -p bin @mkdir -p bin
$(CC) $(CFLAGS) rsa.cpp -o bin/rsa -lssl -lcrypto $(CC) $(CFLAGS) rsa.cpp -o bin/rsa -lssl -lcrypto
install: bin/shepherd install: build/shepherd
install -m 0755 bin/shepherd $(prefix)/bin install -m 0755 $@ $(prefix)/bin
.PHONY: test .PHONY: test
test: test:
@ -24,7 +44,8 @@ test:
# remove produced files, invoke as "make clean" # remove produced files, invoke as "make clean"
clean: clean:
rm -f bin/* @echo clean build*
@rm -f build/*
#%.o : %.cpp #%.o : %.cpp
# $(CC) $(CFLAGS) -c $^ -o $@ # $(CC) $(CFLAGS) -c $^ -o $@