root/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
CC=gcc
LIBS=-lpthread -lncursesw -lcurl -lm -ljansson
LIB_DIRS:=-L$(CURDIR)/jansson/src/.libs/
INCLUDE_DIRS:=-I$(CURDIR)/jansson/src
CFLAGS=-std=c99 -Wall -pedantic -g
DEFINES=-D _DEFAULT_SOURCE
C_HEADERS:=$(wildcard *.h)
C_FILES:=$(wildcard *.c)
C_ALL:=$(C_HEADERS) $(C_FILES)

INSTALL_PREFIX=$/usr/local
VERSION=0.1
ARCHIVE_FORMAT=tar.gz

MKDIR=mkdir -p

BIN_DIR=bin

main: prepareDir
	$(CC) $(CFLAGS) $(DEFINES) $(C_FILES) $(LIBS) $(LIB_DIRS) $(INCLUDE_DIRS) -o $(BIN_DIR)/$@

test:
	$(CC) $(CFLAGS) $(DEFINES) List.c StringReplace.c tests/StringReplaceTest.c $(LIBS) -o $(BIN_DIR)/test1
	$(CC) $(CFLAGS) $(DEFINES) List.c tests/ListTest.c $(LIBS) -o $(BIN_DIR)/test2

install:
	$(MKDIR) $(INSTALL_PREFIX)/bin
	install ./bin/main $(INSTALL_PREFIX)/bin/mnc

check: test
	test -f ./bin/main
	./bin/test1
	./bin/test2

archive:
	git archive --format=$(ARCHIVE_FORMAT) --prefix=media-u-ncurses/ HEAD > media-u-ncurses-$(VERSION).$(ARCHIVE_FORMAT)

publish_release: archive
	scp media-u-ncurses-$(VERSION).$(ARCHIVE_FORMAT) "nee@pictor.uberspace.de:/var/www/virtual/nee/hidamari.blue/git/media-u-ncurses/release/"


prepareDir:
	$(MKDIR) $(BIN_DIR)