forked from emericg/EGM96
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (39 loc) · 1.27 KB
/
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
44
45
46
47
48
49
50
PROJNAME = egm96
SRCS = src
PLIBNAME = lib$(PROJNAME).a
PROGNAME1 = $(PROJNAME)
PROGNAME2 = $(PROJNAME)_gen
PROGS = $(PROGNAME1) $(PROGNAME2)
CC = gcc
CFLAGS = -Wall
LDFLAGS = -lm -s
AR = ar
PREFIX = /usr/local
INSTALL = install
LN = ln -fs
GROFF2PDF = groff -m man -T pdf
RM = rm -f
.PHONY: all clean install
all: $(PROGS)
clean:
$(RM) $(SRCS)/*.o $(PLIBNAME) $(PROGS) man_*.pdf
$(SRCS)/$(PROJNAME).o: $(SRCS)/$(PROJNAME).c
$(CC) $(CFLAGS) -c $^ -o $@
$(PLIBNAME): $(SRCS)/$(PROJNAME).o
$(AR) rcs $@ $^
$(PROGNAME1): $(SRCS)/$(PROGNAME1)_cli.c $(PLIBNAME)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(PROGNAME2): $(SRCS)/$(PROGNAME2).c $(PLIBNAME)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
manual: man_$(PROGNAME1).pdf man_$(PROGNAME2).pdf
man_$(PROGNAME1).pdf: man/man1/$(PROGNAME1).1
$(GROFF2PDF) $^ > $@
man_$(PROGNAME2).pdf: man/man1/$(PROGNAME2).1
$(GROFF2PDF) $^ > $@
install: $(PROGS)
$(INSTALL) -d $(PREFIX)/bin
$(INSTALL) -m 0755 $(PROGS) $(PREFIX)/bin/
$(INSTALL) -d $(PREFIX)/share/man/man1
$(INSTALL) -m 0644 man/man1/*.1 $(PREFIX)/share/man/man1
$(INSTALL) -d $(PREFIX)/share/doc/$(PROJNAME)
$(INSTALL) -m 0644 LICENSE README.md doc/* $(PREFIX)/share/doc/$(PROJNAME)