summaryrefslogtreecommitdiff
path: root/Makefile
blob: 8c809b352db87b6974130ce34b383bfc35b3a933 (plain) (blame)
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
PROJECT=microbbs
CC=gcc
CFLAGS=
SOURCES=articles.c bbsconfig.c buildinfo.c captcha.c door.c file_use.c ini.c list.c logs.c mmm.c motd.c sds.c session.c statistics.c sysinfo.c telnetd.c textview.c todo.c twit.c user.c vote.c
OBJECTS=$(SOURCES:.c=.o)
BUILD_DIR=build_dir

all: mkdir $(OBJECTS) $(PROJECT)

mkdir:
	mkdir -p $(BUILD_DIR)
 
kconfig2h:
	$(CC) -c kconf2h/kconf2h_parser.c
	$(CC) kconf2h/kconf2h.c kconf2h_parser.o -o kconf2h/kconf2h

menuconfig: kconfig2h
	./mconf Kconfig
	kconf2h/kconf2h .config kconfig.h 
 
$(PROJECT): $(SOURCES)
	cd ./libterm; make
	$(CC) $(addprefix $(BUILD_DIR)/,$(OBJECTS)) $(CFLAGS) libterm/libterm.o microbbs.c -o $(PROJECT)
 
%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $(BUILD_DIR)/$@

leak:
	valgrind --leak-check=full --track-origins=yes --log-file=log.txt ./$(PROJECT)


clean:
	rm -rf *.o microbbs
	cd ./$(BUILD_DIR); rm -rf *.o
	cd ./libterm; make clean