This repository has been archived by the owner on Feb 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
78 lines (56 loc) · 2.71 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
CC = gcc
C_FLAGS = -Wall -pedantic -Werror -g -std=gnu99
L_FLAGS = -lz -lpthread -lsqlite3
C_FLAGS_TEST = -Wall -pedantic -Werror -g -std=gnu99
L_FLAGS_TEST = -lz -lcheck -lpthread -lsqlite3
# os-dependent flags
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
L_FLAGS_TEST += -lsubunit -lrt -lm
endif
SRC_FILES = $(wildcard src/*.c)
OBJ_FILES = $(filter-out src/main.o, $(SRC_FILES:.c=.o))
CHECK_FILES = $(wildcard tests/*.test)
CHECK_FILES_EXE = $(CHECK_FILES:.test=.run)
all: src/main.o src/libguildmud.a src/crypt_blowfish-1.3-mini/libblowfish-1.3.a
@$(CC) -o src/guildmud src/main.o src/libguildmud.a src/crypt_blowfish-1.3-mini/libblowfish-1.3.a $(L_FLAGS)
src/libguildmud.a: $(OBJ_FILES)
@ar ru $@ $^
@ranlib $@
.c.o: all
@$(CC) -c $(C_FLAGS) -o $@ $<
telnet-test:
@echo "Requires guildmud to be running"
@cd tests/ && find . -maxdepth 1 -name '*.tcl' -exec {} \; && cd ..
test: $(CHECK_FILES_EXE)
@find tests/ -maxdepth 1 -name '*.run' -exec {} \;
tests/%.run: tests/%.c src/libguildmud.a src/crypt_blowfish-1.3-mini/libblowfish-1.3.a
@$(CC) -o $@ $< src/libguildmud.a src/crypt_blowfish-1.3-mini/libblowfish-1.3.a $(C_FLAGS_TEST) -Isrc/ $(L_FLAGS_TEST) -Lsrc/
tests/%.c: tests/%.test
@checkmk $< > $@
install:
@echo To be implemented shortly...
.PHONY: clean
clean:
@echo Cleaning code ...
@rm -rf src/*.o src/guildmud src/libguildmud.a src/*~ tests/*.c tests/*.run tests/*.dSYM src/*.dSYM
@rm -rf src/crypt_blowfish-1.3-mini/*.o src/crypt_blowfish-1.3-mini/*~ src/crypt_blowfish-1.3-mini/*a src/crypt_blowfish-1.3-mini/mini-test
# Blowfish compilation rules
AS = $(CC)
LD = $(CC)
BFISH_CFLAGS = -g -W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wundef -Wpointer-arith -O2 -fomit-frame-pointer -funroll-loops
BFISH_ASFLAGS = -c
BFISH_LDFLAGS = -sL
CRYPT_OBJS = src/crypt_blowfish-1.3-mini/crypt_blowfish.o \
src/crypt_blowfish-1.3-mini/crypt_gensalt.o \
src/crypt_blowfish-1.3-mini/wrapper.o
crypt: src/crypt_blowfish-1.3-mini/libblowfish-1.3.a src/crypt_blowfish-1.3-mini/mini-test
src/crypt_blowfish-1.3-mini/libblowfish-1.3.a: $(CRYPT_OBJS)
@ar ru $@ $^
@ranlib $@
src/crypt_blowfish-1.3-mini/mini-test: src/crypt_blowfish-1.3-mini/mini-test.o src/crypt_blowfish-1.3-mini/libblowfish-1.3.a
$(CC) -o $@ $< $(L_FLAGS) src/crypt_blowfish-1.3-mini/libblowfish-1.3.a
src/crypt_blowfish-1.3-mini/crypt_blowfish.o: src/crypt_blowfish-1.3-mini/crypt_blowfish.h
src/crypt_blowfish-1.3-mini/crypt_gensalt.o: src/crypt_blowfish-1.3-mini/crypt_gensalt.h
src/crypt_blowfish-1.3-mini/wrapper.o: src/crypt_blowfish-1.3-mini/crypt.h src/crypt_blowfish-1.3-mini/ow-crypt.h \
src/crypt_blowfish-1.3-mini/crypt_blowfish.h src/crypt_blowfish-1.3-mini/crypt_gensalt.h