-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
41 lines (33 loc) · 1.17 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
ifneq ($(SOURCES),)
# we're in a chesto-style lib
LIBGET := $(CURDIR)/libs/get/src
LIBGET_REPOS := $(LIBGET)/repos
else
# we are in the libget folder already
LIBGET := ./src
APP_VERSION := 2.0-$(shell git describe --tags --always --dirty)
endif
RAPIDJSON := $(LIBGET)/libs/rapidjson/include
MINIZIP := $(LIBGET)/libs/minizip
TINYXML := $(LIBGET)/libs/tinyxml
SOURCES += $(LIBGET) $(LIBGET_REPOS) $(MINIZIP) $(TINYXML)
INCLUDES += $(RAPIDJSON) $(MINIZIP) $(TINYXML)
VPATH += $(LIBGET) $(LIBGET_REPOS) $(MINIZIP) $(TINYXML)
CFLAGS += -DNETWORK
LDFLAGS += -lcurl
MINIZIP_O := zip.o ioapi.o unzip.o
ifeq ($(LIBGET),./src)
build:
gcc -c $(MINIZIP)/*.c
g++ -g cli/*.cpp src/*.cpp src/repos/*.cpp -std=gnu++20 -lm -I $(RAPIDJSON) $(MINIZIP_O) -I $(MINIZIP) -lz -lcurl -o get -DAPP_VERSION=\"$(APP_VERSION)\"
run_tests:
rm -rf tests/.get/packages tests/.get/tmp
gcc -c $(MINIZIP)/*.c
g++ -g tests/*.cpp src/*.cpp src/repos/*.cpp -std=gnu++20 -lm -L/usr/lib -I $(RAPIDJSON) $(MINIZIP_O) -I $(MINIZIP) -lz -lcurl -o get_tests
cd tests/server && python3 -m http.server &
export SERVERD=$!
sleep 2
./get_tests
clean:
rm *.o get get_tests
endif