forked from JohannesBuchner/verynice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
111 lines (81 loc) · 3.31 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#
# VeryNice -- a dynamic process re-nicer
# Copyright (C) 2000 Stephen D. Holland
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
CC = gcc
RPM_BUILD_ROOT=
# PREFIX is usually either /usr or /usr/local
PREFIX=/usr/local
TARGET=linux
INSTALL=install
# Solaris users probably need to use this:
#INSTALL=/usr/ucb/install
VERSION=1.1
#CFLAGS= -I../include/ -O3 -Wimplicit
CFLAGS= -I../include/ -g -Wimplicit -DPREFIX=\"$(PREFIX)\" -DTARGET_$(TARGET) -DVERSION=\"$(VERSION)\"
LINK = gcc
AG = /home3/sdh4/anagram/ag_unix_dev/ag
all: verynice
clean:
rm -f *.o *~ core
distclean: clean
rm -f verynice
# distribution build procedure:
# make dist
# as root: make buildrpm
# make postbuildrpm
dist: distclean
(cd .. ; tar cvzf verynice-$(VERSION).tar.gz verynice/ )
install:
$(INSTALL) -d $(RPM_BUILD_ROOT)$(PREFIX)/sbin
$(INSTALL) verynice $(RPM_BUILD_ROOT)$(PREFIX)/sbin
if [ $(PREFIX) = "/usr" ]; then \
mv -f $(RPM_BUILD_ROOT)/etc/verynice.conf $(RPM_BUILD_ROOT)/etc/verynice.conf~ ; \
$(INSTALL) verynice.conf $(RPM_BUILD_ROOT)/etc ; \
else \
$(INSTALL) -d $(RPM_BUILD_ROOT)$(PREFIX)/etc ; \
mv -f $(RPM_BUILD_ROOT)$(PREFIX)/etc/verynice.conf $(RPM_BUILD_ROOT)$(PREFIX)/etc/verynice.conf~ ; \
$(INSTALL) -m 644 verynice.conf $(RPM_BUILD_ROOT)$(PREFIX)/etc ; \
fi
$(INSTALL) -d $(RPM_BUILD_ROOT)$(PREFIX)/share
$(INSTALL) -d $(RPM_BUILD_ROOT)$(PREFIX)/share/doc
$(INSTALL) -d $(RPM_BUILD_ROOT)$(PREFIX)/share/doc/verynice-$(VERSION)
$(INSTALL) -m 644 verynice.html $(RPM_BUILD_ROOT)$(PREFIX)/share/doc/verynice-$(VERSION)
$(INSTALL) -m 644 README $(RPM_BUILD_ROOT)$(PREFIX)/share/doc/verynice-$(VERSION)
$(INSTALL) -m 644 README.SYN $(RPM_BUILD_ROOT)$(PREFIX)/share/doc/verynice-$(VERSION)
$(INSTALL) -m 644 COPYING $(RPM_BUILD_ROOT)$(PREFIX)/share/doc/verynice-$(VERSION)
$(INSTALL) -m 644 CHANGELOG $(RPM_BUILD_ROOT)$(PREFIX)/share/doc/verynice-$(VERSION)
buildrpm:
cp ../verynice-$(VERSION).tar.gz /usr/src/redhat/SOURCES
rm -f /usr/src/redhat/SRPMS/verynice-$(VERSION)-1.src.rpm
rm -f /usr/src/redhat/RPMS/*/verynice-$(VERSION)-1.*.rpm
sed 's/VERSION/$(VERSION)/' <verynice.spec >/usr/src/redhat/SOURCES/verynice.spec
rpm -ba /usr/src/redhat/SOURCES/verynice.spec
postbuildrpm:
cp /usr/src/redhat/SRPMS/verynice-$(VERSION)-1.src.rpm ..
cp /usr/src/redhat/RPMS/*/verynice-$(VERSION)-1.*.rpm ..
%.c: %.syn
$(AG) -b $<
# convenience rule for analyzing a grammar
anal.%: %.syn
$(AG) $*
verynice: verynice.o config.o linklist.o stringstack.o
$(LINK) -g -o $@ $^ -lm
# dependencies
config.o: config.c linklist.h stringstack.h verynice.h
config.c: config.syn
linklist.o: linklist.c linklist.h
stringstack.o: stringstack.c stringstack.h linklist.h
verynice.o: verynice.c verynice.h linklist.h