File: Makefile

package info (click to toggle)
xnetload 1.11.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 128 kB
  • ctags: 120
  • sloc: ansic: 712; makefile: 105
file content (135 lines) | stat: -rw-r--r-- 3,529 bytes parent folder | download | duplicates (3)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# $Id: Makefile,v 1.9 2001/06/02 10:38:38 rsmith Exp $
# This is the Makefile for xnetload

# If make complains about a missing file, run 'make depend' first

# Define the C compiler to be used, usually gcc.
CC = gcc

# The next two lines are for building an executable suitable for debugging.
#CFLAGS = -pipe -g -O0 -Wall
#LFLAGS = -pipe -Wall

# The next two lines are for building an optimized program.
CFLAGS = -pipe -O2 -Wall -DNDEBUG
LFLAGS = -s -pipe -Wall

# These two lines are for building Athlon optimized programs.
#CFLAGS = -s -O3 -fomit-frame-pointer -Wall -mpentiumpro -march=pentiumpro -malign-functions=4 -funroll-loops -fexpensive-optimizations -malign-double -fschedule-insns2 -mwide-multiply -DNDEBUG
#LFLAGS = -s -pipe -Wall

# Libraries to link against
LIBS = -lXaw -lXmu -lXt -lX11 -lm -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

##### Maintainer stuff goes here:

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

# Files that need to be included in the distribution
DISTFILES = README COPYING Makefile $(BASENAME).1

# Source files.
SRCS = data.c x11-ui.c

# Extra stuff to add into the distribution.
XTRA_DIST= XNetload

##### No editing necessary beyond this point
# Object files.
OBJS = $(SRCS:.c=.o)

# Predefined directory/file names
PKGDIR  = $(BASENAME)-$(VMAJOR).$(VMINOR).$(VPATCH)
TARFILE = $(BASENAME)-$(VMAJOR).$(VMINOR).$(VPATCH).tar.gz
BACKUP  = $(BASENAME)-backup-$(VMAJOR).$(VMINOR).$(VPATCH).tar.gz

# Version number
VERSION = -DVERSION=\"$(VMAJOR).$(VMINOR).$(VPATCH)\"
# Program name
PACKAGE = -DPACKAGE=\"$(BASENAME)\"
# Add to CFLAGS
CFLAGS += $(VERSION) $(PACKAGE)

LOG = ChangeLog
DISTFILES += $(LOG)

.PHONY: clean install uninstall dist backup all $(LOG)

all: $(BASENAME)

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

# compresses the manual page
$(BASENAME).1.gz: $(BASENAME).1
	cp $(BASENAME).1 $(BASENAME).1.org
	gzip -f $(BASENAME).1
	mv $(BASENAME).1.org $(BASENAME).1

# Remove all generated files.
clean:;
	rm -f $(OBJS) $(BASENAME) *~ core \
	$(TARFILE) $(BACKUP) $(BASENAME).1.gz

log: $(LOG)

$(LOG):;
	rm -f $(LOG) 
	rcs2log -i 2 -l 70 >$(LOG)

# Install the program and manual page. You should be root to do this.
install: $(BASENAME) $(BASENAME).1.gz
	@if [ `id -u` != 0 ]; then \
		echo "You must be root to install the program!"; \
		exit 1; \
	fi
	cp $(BASENAME) $(BINDIR)
	cp $(BASENAME).1.gz $(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: $(DISTFILES) $(XTRA_DIST)
	rm -rf $(PKGDIR)
	mkdir -p $(PKGDIR)
	cp $(DISTFILES) $(XTRA_DIST) $(SRCS) *.h $(PKGDIR)
	tar -czf $(TARFILE) $(PKGDIR)
	rm -rf $(PKGDIR)


# Make a backup, complete with the RCS files. Only for the maintainer.
backup: clean $(LOG)
	rm -rf /tmp/$(PKGDIR)
	mkdir -p /tmp/$(PKGDIR)
	cp -R -p * /tmp/$(PKGDIR)
	CURDIR=`pwd`
	cd /tmp ; tar -czf $(CURDIR)/$(BACKUP) $(PKGDIR)
	rm -rf /tmp/$(PKGDIR)

# if the file depend doesn't exist, run 'make depend' first.
depend:
	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