forked from jiggak/tinyurl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
32 lines (23 loc) · 822 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
# URL where tinyurl is installed, used by shell script only
SCRIPT_URL=http://0x2a.ca/
# directory where URL files are stored
DATA_DIR=/home/web/0x2a.ca/links
# number of characters used to generate URL tokens
TOKEN_LEN=3
CXX=g++
CXXFLAGS=-Wall -DDATA_DIR=\"$(DATA_DIR)\" -DTOKEN_LEN=$(TOKEN_LEN)
LDFLAGS=-lfcgi++
all: tinyurl.fcgi tinyurl
tinyurl: tinyurl.in tinyurl.bash.in
@sed 's/@DATA_DIR@/$(subst /,\/,$(DATA_DIR))/' tinyurl.in | \
sed 's/@TOKEN_LEN@/$(TOKEN_LEN)/' | \
sed 's/@SCRIPT_URL@/$(subst /,\/,$(SCRIPT_URL))/' > tinyurl
@chmod +x tinyurl
@sed 's/@DATA_DIR@/$(subst /,\/,$(DATA_DIR))/' tinyurl.bash.in \
> tinyurl.bash
tinyurl.fcgi: src/tinyurl.o src/fcgi_io.o
$(CXX) -o $@ $(LDFLAGS) $^
.cpp.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
clean:
@rm src/*.o tinyurl.fcgi tinyurl