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
|
||||
SD ?= src
|
||||
LIBS_DIR ?= libs
|
||||
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
|
||||
|
||||
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
|
||||
LIB_TARGETS = $(patsubst $(LIBS_DIR)/%,$(BD)/lib%.a,$(LIBS))
|
||||
@ -24,14 +26,14 @@ $(BD)/libqments.a:
|
||||
$(MAKE) -C $(LIBS_DIR)/qments static
|
||||
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)
|
||||
|
||||
$(BD)/%.o: $(SD)/%.c $(LIB_TARGETS)
|
||||
mkdir -p $(@D)
|
||||
$(CC) $(INCLUDE_DIRS) $(CFLAGS) -c $< -o $@ $(LDFLAGS)
|
||||
|
||||
all: $(BD)/$(CGI_EXEC)
|
||||
all: $(BD)/$(CGI_EXECS)
|
||||
|
||||
clean:
|
||||
rm -rfI $(BD)/
|
||||
|
@ -7,6 +7,7 @@
|
||||
int user_by_session_id(const char *session_id, char *username);
|
||||
|
||||
/* 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);
|
||||
|
||||
#endif /* AUTH_H */
|
||||
|
Loading…
Reference in New Issue
Block a user