Makefile (1164B)
1 TARGET = diary 2 SRCDIR = src/ 3 _SRC = export.c import.c utils.c caldav.c diary.c 4 SRC = $(addprefix $(SRCDIR), $(_SRC)) 5 PREFIX ?= /usr/local 6 BINDIR ?= $(DESTDIR)$(PREFIX)/bin 7 8 MANDIR := $(DESTDIR)$(PREFIX)/share/man 9 MAN1 = man1/diary.1 10 11 CC = gcc 12 CFLAGS = -Wall $(shell pkg-config libxml-2.0 --cflags) 13 UNAME = $(shell uname) 14 15 XML_LIBS = $(shell pkg-config libxml-2.0 --libs) 16 17 ifeq ($(UNAME),FreeBSD) 18 LIBS = -lncurses -lcurl $(ML_LIBS) -ldl -pthread 19 endif 20 21 ifeq ($(UNAME),Linux) 22 LIBS = -lncursesw -lcurl $(XML_LIBS) -ldl -pthread 23 endif 24 25 ifeq ($(UNAME),Darwin) 26 LIBS = -lncurses -lcurl $(XML_LIBS) -ldl -pthread -framework CoreFoundation 27 endif 28 29 30 default: $(TARGET) 31 32 $(TARGET): $(SRC) 33 @# -I: Search this dir for header files 34 $(CC) -I $(SRCDIR) $(SRC) -o $(TARGET) $(CFLAGS) $(LIBS) 35 36 debug: $(SRC) 37 @# -g: Produce debugging information (for GDB) 38 $(CC) -I $(SRCDIR) $(SRC) -o $(TARGET) $(CFLAGS) -g $(LIBS) 39 40 clean: 41 @# cleanup target 42 rm -f $(TARGET) 43 44 install: $(TARGET) 45 mkdir -p $(BINDIR) 46 install -m755 $(TARGET) $(BINDIR)/$(TARGET) 47 install -d $(MANDIR)/man1 48 install -m644 $(MAN1) $(MANDIR)/$(MAN1) 49 50 uninstall: 51 rm -f $(BINDIR)/$(TARGET) 52 rm -f $(MANDIR)/$(MAN1)