File: Makefile

package info (click to toggle)
logapp 0.14-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 272 kB
  • ctags: 249
  • sloc: ansic: 2,660; xml: 559; makefile: 154
file content (92 lines) | stat: -rw-r--r-- 1,911 bytes parent folder | download
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Makefile for Logapp
#
# Copyright (C) 2007-2009 Michael Brunner <mibru@gmx.de>

TARGET = logapp
MANPAGE = logapp.1
VERSION = 0.14

# Configuration options:
SUPPORT_PTY = 1
USE_THREADS = 1
BUILD_STATIC = 0

# Add architecture prefix here or use CROSS_COMPILE environment variable to
# specify a cross compiler
CROSS_COMPILE ?=

SYMLINKS = logmake logsvn logcvs
PREFIX = /usr/local/
DESTDIR = $(PREFIX)bin/
MANDIR = $(PREFIX)share/man/man1/

CC = $(CROSS_COMPILE)gcc
DEFS    = -DSVN_REVISION='"$(shell svnversion -cn . 2>/dev/null \
	| sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/")"' \
	 -DVERSION='"$(VERSION)"' \
	 -DEXECUTABLE='"$(TARGET)"' \
	 -DCONFIG_SUPPORT_PTY="$(SUPPORT_PTY)" \
	 -DCONFIG_USE_THREADS="$(USE_THREADS)"
 
CFLAGS = -Wall -Wextra -O2 $(DEFS)

LINK = $(CROSS_COMPILE)gcc
LINKFLAGS = -s 

ifeq ($(BUILD_STATIC),1)
	LINKFLAGS += --static
endif

OBJECTS = main.o configuration.o logfile.o capture.o

DEPENDENCIES = .dependencies
EXTRADEPS = Makefile

LIBS = 
ifeq ($(SUPPORT_PTY),1)
	LIBS += -lutil
endif
ifeq ($(USE_THREADS),1)
	LIBS += -lpthread
endif

all: $(DEPENDENCIES) $(TARGET)

$(TARGET): $(OBJECTS)
	$(LINK) $(LINKFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)

install: all install_links
	install -d $(DESTDIR)
	install -t $(DESTDIR) $(TARGET)
	install -d $(MANDIR)
	install -m 644 -t $(MANDIR) $(MANPAGE)

install_links:
	for L in $(SYMLINKS); do ln -s -f $(TARGET) $(DESTDIR)$$L ; done

uninstall: deinstall

deinstall: remove_links
	rm -f $(DESTDIR)$(TARGET)
	rm -f $(MANDIR)$(MANPAGE)

remove_links:
	for L in $(SYMLINKS); do rm -f $(DESTDIR)$$L ; done

clean:
	rm -f *.o $(TARGET) $(DEPENDENCIES)
	@make -C doc clean

distclean: clean
	rm -f *.log tags

man:
	@$(MAKE) -C doc update-main

$(DEPENDENCIES):
	@$(CC) -MM *.c | sed -e 's/$$/ $(EXTRADEPS)/' > $(DEPENDENCIES)

.PHONY: all clean distclean deinstall uninstall install install_links \
	remove_links man

-include $(DEPENDENCIES)