-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (37 loc) · 917 Bytes
/
Makefile
File metadata and controls
46 lines (37 loc) · 917 Bytes
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
46
# options
SENSOR = no #yes
AUTH = BASIC_AUTH #DIGEST_AUTH
BEARER = yes
LOCAL_ONLY = yes
LIB_PATH = $(HOME)/Library/libmicrohttpd
SRC_DIR = src
LIBS = -lmicrohttpd -ljansson -lm -lpthread
INCLUDES = -I$(LIB_PATH)/include/
LIBRARIES = -L$(LIB_PATH)/lib/
OBJ_FILES = $(patsubst %.c, %.o, $(wildcard $(SRC_DIR)/*.c))
TARGET = httpserver.out
CFLAGS = -c -Wall
LDFLAGS = -g
CC = gcc
LD = gcc
ifeq ($(SENSOR),yes)
LIBS += -lbmp280
CPPFLAGS += -DSENSOR
endif
ifeq ($(BEARER),yes)
CPPFLAGS += -DBEARER_AUTH
endif
ifeq ($(LOCAL_ONLY),yes)
CPPFLAGS += -DLOCAL_ONLY
endif
CPPFLAGS += -D$(AUTH)
all: $(TARGET)
$(TARGET) : $(OBJ_FILES)
$(LD) $(LDFLAGS) -o $@ $(OBJ_FILES) $(LIBRARIES) $(LIBS)
$(OBJ_FILES): %.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $< -o $@
clean :
rm -R *.out $(SRC_DIR)/*.o $(SRC_DIR)/*.a *.dSYM
run:
export LD_LIBRARY_PATH=$(LIB_PATH)/lib
./httpserver.out