-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
45 lines (32 loc) · 848 Bytes
/
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
42
43
44
45
EXEC := demd
CC := g++
LDFLAGS ?=
LIBS ?= -lgdal -levent -ljson-c
SRCS := $(wildcard *.cpp)
# Objs are all the sources, with .cpp replaced by .o
OBJS := $(SRCS:.cpp=.o)
DEM := dem
HGT := $(DEM)/N23E120.hgt
PORT ?= 8082
STRESS_ARG ?= -c 10
all: $(EXEC)
dem: $(HGT)
$(HGT):
make -C $(DEM)
$(EXEC): $(OBJS)
$(CC) -o $@ $(strip $(CFLAGS) )$^ $(strip $(LDFLAGS) $(LIBS))
%.o: %.cpp
$(CC) -o $@ $(strip $(CFLAGS) $(INCLUDES) )-c $<
serve: $(EXEC) $(HGT)
./$(EXEC) -p $(PORT) $(DEM)
profile: $(EXEC) $(HGT)
@which valgrind || sudo apt-get install valgrind
valgrind --leak-check=full ./$(EXEC) -p $(PORT) $(DEM)
stress:
cd stress; go run . $(STRESS_ARG)
query:
curl -XPOST --data '[[120.957283,23.47]]' http://127.0.0.1:8082/v1/elevations
clean:
@rm -f $(EXEC) $(OBJS)
.PHONY: all dem clean run profile stress query
include docker.mk