Makefile for multiple CGI scripts
This commit is contained in:
parent
140738e4e8
commit
92e7d1ed15
12
Makefile
12
Makefile
@ -1,14 +1,16 @@
|
|||||||
CGI_EXEC ?= main.cgi
|
|
||||||
|
|
||||||
BD ?= build
|
BD ?= build
|
||||||
SD ?= src
|
SD ?= src
|
||||||
LIBS_DIR ?= libs
|
LIBS_DIR ?= libs
|
||||||
LIBS ?= $(wildcard $(LIBS_DIR)/*)
|
LIBS ?= $(wildcard $(LIBS_DIR)/*)
|
||||||
|
|
||||||
|
CGI_EXECS ?= view_comments.cgi
|
||||||
|
EXEC_TARGETS := $(patsubst %.cgi,$(BD)/%.cgi,$(CGI_EXECS))
|
||||||
|
|
||||||
LDFLAGS ?= -L$(BD)/ -lcgic -lqments -lhiredis -ltomcrypt -luuid
|
LDFLAGS ?= -L$(BD)/ -lcgic -lqments -lhiredis -ltomcrypt -luuid
|
||||||
|
|
||||||
SRC_FILES := $(shell find $(SD) -name *.c)
|
SRC_FILES := $(shell find $(SD) -name *.c)
|
||||||
OBJ_FILES := $(patsubst $(SD)/%.c,$(BD)/%.o,$(SRC_FILES))
|
EXEC_OBJS := $(patsubst %.cgi,$(BD)/%.o,$(CGI_EXECS))
|
||||||
|
OBJ_FILES := $(filter-out $(EXEC_OBJS),$(patsubst $(SD)/%.c,$(BD)/%.o,$(SRC_FILES)))
|
||||||
|
|
||||||
INCLUDE_DIRS = -Ilibs/qments/include -Ilibs/cgic
|
INCLUDE_DIRS = -Ilibs/qments/include -Ilibs/cgic
|
||||||
LIB_TARGETS = $(patsubst $(LIBS_DIR)/%,$(BD)/lib%.a,$(LIBS))
|
LIB_TARGETS = $(patsubst $(LIBS_DIR)/%,$(BD)/lib%.a,$(LIBS))
|
||||||
@ -24,14 +26,14 @@ $(BD)/libqments.a:
|
|||||||
$(MAKE) -C $(LIBS_DIR)/qments static
|
$(MAKE) -C $(LIBS_DIR)/qments static
|
||||||
cp $(LIBS_DIR)/qments/$(BD)/libqments.a $(BD)
|
cp $(LIBS_DIR)/qments/$(BD)/libqments.a $(BD)
|
||||||
|
|
||||||
$(BD)/$(CGI_EXEC): $(OBJ_FILES)
|
$(BD)/%.cgi: $(BD)/%.o $(OBJ_FILES)
|
||||||
$(CC) $(INCLUDE_DIRS) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
$(CC) $(INCLUDE_DIRS) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
$(BD)/%.o: $(SD)/%.c $(LIB_TARGETS)
|
$(BD)/%.o: $(SD)/%.c $(LIB_TARGETS)
|
||||||
mkdir -p $(@D)
|
mkdir -p $(@D)
|
||||||
$(CC) $(INCLUDE_DIRS) $(CFLAGS) -c $< -o $@ $(LDFLAGS)
|
$(CC) $(INCLUDE_DIRS) $(CFLAGS) -c $< -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
all: $(BD)/$(CGI_EXEC)
|
all: $(BD)/$(CGI_EXECS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rfI $(BD)/
|
rm -rfI $(BD)/
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
int user_by_session_id(const char *session_id, char *username);
|
int user_by_session_id(const char *session_id, char *username);
|
||||||
|
|
||||||
/* return 0 on failure, 1 on success, negative number on error */
|
/* return 0 on failure, 1 on success, negative number on error */
|
||||||
|
/* authenticate must assign a session id */
|
||||||
int authenticate(const char *username, const char *password, char *sid);
|
int authenticate(const char *username, const char *password, char *sid);
|
||||||
|
|
||||||
#endif /* AUTH_H */
|
#endif /* AUTH_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user