File: Makefile

package info (click to toggle)
xnetload 1.4pre2-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 100 kB
  • ctags: 85
  • sloc: ansic: 518; makefile: 87
file content (91 lines) | stat: -rw-r--r-- 2,393 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
# Makefile for xnetload 1.4
#
# $Id: Makefile,v 1.4 1998/04/10 20:34:41 rsmit06 Exp rsmit06 $
#

CC = gcc
CFLAGS = -O2 -Wall -DNUMAVG=5
#CFLAGS = -g -Wall -DNUMAVG=5 # for debugging
LIBS = -lXaw -lXmu -lXt -lX11

# This should be set with environment variables, but nobody does that,
# so I'll set these here.
HDIRS = -I/usr/X11R6/include
LDIRS = -L/usr/X11R6/lib

# Location where to install the binary.
BINDIR = /usr/local/bin

# Location where to install the manual-page.
MANDIR = /usr/local/man/man1

# Package name and version: BASENAME-VMAJOR.VMINOR.tar.gz
BASENAME = xnetload
VMAJOR   = 1
VMINOR   = 4

# Directory in which this library is built
BUILDDIR = $(BASENAME)-$(VMAJOR).$(VMINOR)

# If one of these is missing, comment them out!
README  = $(BUILDDIR)/README
LICENSE = $(BUILDDIR)/LICENSE
MANPAGE = $(BUILDDIR)/$(BASENAME).1
APPDEF  = $(BUILDDIR)/XNetload

# Object files.
OBJS = data.o x11-ui.o

##### No editing necessary beyond this point
.PHONY: clean install uninstall dist backup

# builds a binary.
$(BASENAME): $(OBJS)
	$(CC) $(CFLAGS) $(LDIRS) -o $(BASENAME) $(LIBS) $(OBJS)

# Remove all generated files.
clean:;
	rm -f $(OBJS) $(BASENAME) *~ core \
	$(BASENAME)-$(VMAJOR).$(VMINOR).tar.gz \
	$(BASENAME)-backup-$(VMAJOR).$(VMINOR).tar.gz 

# Install the program and manual page. You should be root to do this.
install: $(BASENAME)
	@if [ `id -u` != 0 ]; then \
		echo "You must be root to install the program!"; \
		exit 1; \
	fi
	cp $(BASENAME) $(BINDIR)
	cp $(BASENAME).1 $(MANDIR)

uninstall:;
	@if [ `id -u` != 0 ]; then \
		echo "You must be root to uninstall the program!"; \
		exit 1; \
	fi
	rm -f $(BINDIR)/$(BASENAME)
	rm -f $(MANDIR)/$(BASENAME).1

# Build a tar distribution file. Only needed for the maintainer.
dist:;
	cd .. ; tar -czf $(BUILDDIR)/$(BASENAME)-$(VMAJOR).$(VMINOR).tar.gz \
	$(README) $(LICENSE) $(MANPAGE) \
	$(BUILDDIR)/Makefile $(BUILDDIR)/depend $(APPDEF) \
	$(BUILDDIR)/*.h $(BUILDDIR)/*.c 

# Make a backup, complete with the RCS files. Only for the maintainer.
backup: clean
	cd .. ; \
	tar -czf $(BUILDDIR)/$(BASENAME)-backup-$(VMAJOR).$(VMINOR).tar.gz \
	$(BUILDDIR)/*

# if the file depend doesn't exist, run 'make depend' first.
depend: $(OBJS:.o=.c)
	gcc -MM $(OBJS:.o=.c) >depend

# implicit rule (is needed because of HDIRS!)
.c.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) $(HDIRS) -c -o $@ $<

# DO NOT DELETE THIS LINE 
include depend