-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (55 loc) · 1.25 KB
/
Copy pathMakefile
File metadata and controls
73 lines (55 loc) · 1.25 KB
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
##Revision: $Revision: 1.0 $
##RCSdate: $Date: 2014/06/11 21:10:10 $
APPNAME=gpsread
VERSION=0.9.3
# Where to install.
PREFIX=/usr/local
# What OS?
UNAME:=$(shell uname)
# Special compiler?
CC=gcc
# Basic options.
CFLAGS=-std=c99 -W -Wall -DVERSION=$(VERSION)
LFLAGS=
# Basic libraries.
ifeq ($(UNAME), Linux)
LIBS=-lm -lconfuse
endif
ifeq ($(UNAME), Darwin)
LIBS=-lm -lintl -lconfuse
endif
# All the code.
CODE = Makefile $(wildcard *.h) $(wildcard *.c)
# All the C source files.
SOURCES = $(wildcard *.c)
# All compiled C source files.
OBJECTS = $(SOURCES:.c=.o)
# Make search path.
VPATH=./rcsrepo
# Compile one file
.c.o:
$(CC) $(CFLAGS) -MMD -c $<
# Default target.
all: $(APPNAME)
# Pull in header info.
-include *.d
# Link the app.
$(APPNAME): $(OBJECTS)
$(CC) $(LFLAGS) -o $(APPNAME) $(OBJECTS) $(LIBS)
# Manpage.
$(APPNAME).1.gz: $(APPNAME).1
cat $(APPNAME).1 | gzip -9 > $(APPNAME).1.gz
# Install the app.
install: $(APPNAME) $(APPNAME).1.gz
install -D -m755 $(APPNAME) $(PREFIX)/bin/$(APPNAME)
install -D -m644 $(APPNAME).1.gz $(PREFIX)/man/man1/$(APPNAME).1.gz
# Zap the cruft.
clean:
rm -f *~
rm -f *.d
rm -f *.o
rm -f tags
rm -f $(APPNAME)
rm -f $(APPNAME).1.gz
rm -rf $(APPNAME).dSYM
# vim:ts=2:sw=2:tw=150:fo=tcnq2b:foldmethod=indent