File: Makefile

package info (click to toggle)
ttyload 0.5%2B20131024%2Bgitf949537-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 244 kB
  • sloc: ansic: 677; makefile: 63; sh: 36
file content (93 lines) | stat: -rw-r--r-- 2,080 bytes parent folder | download | duplicates (2)
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
# Makefile for ttyload
# Copyright 2001 by David Lindes, All Rights Reserved
# see the "LICENSE" file for licensing info.

# change this if you want to use 'make install' and have it go
# somewhere else:
INSTALLDIR	= /usr/local/bin

ARCH	= `uname -s | sed -e 's/[ \/]/-/g'`
LDFLAGS	= `./ldflags`

OBJS	=	arch/${ARCH}/getload.o	\
		arch/${ARCH}/terminfo.o	\
		${NULL}

# this is what I use most places...
CC=gcc -pedantic -Wall -Werror

# for the things in the sub-directory:
INCLUDES	=	-I$${PWD:-.} \
			-I$${PWD:-.}/arch/${ARCH} \
			-I$${PWD:-.}/arch/default

# Debugging compiles?
DEBUG	= -g

VERSION	= -DVERSION='"'`cat Version`'"'

CFLAGS	= $(INCLUDES) $(OTHER_FLAGS) $(DEBUG) $(VERSION)

# most people won't want loader, so don't bother building it:
# PROGRAMS =	archbuild loader
PROGRAMS =	archbuild

default:	$(PROGRAMS)

test:		$(PROGRAMS)
	./ttyload -i 1

# which architechtures are just symlinks?
ARCHLINKS_FREEBSD	=	\
	arch/Darwin		\
	arch/Isilon-OneFS	\
	arch/GNU-kFreeBSD	\
	${NULL}

ARCHLINKS_THISARCH	=	\
	arch/thisarch		\
	${NULL}

ARCHLINKS	=		\
	$(ARCHLINKS_FREEBSD)	\
	$(ARCHLINKS_THISARCH)	\
	${NULL}

# Some architechtures mimic eachother:
$(ARCHLINKS_FREEBSD):
	ln -s FreeBSD $@

$(ARCHLINKS_THISARCH):
	ln -s ${ARCH} $@

archlinks: $(ARCHLINKS)

archbuild: archlinks
	make archtest ttyload ARCH=$(ARCH)

ttyload.c:	ttyload.h Version
	touch ttyload.c

# have to be explicit here, for some make systems, like .c.o below:
ttyload: $(OBJS) ttyload.o
	$(CC) $(LDFLAGS) -o $@ $(OBJS) ttyload.o

archtest: $(OBJS) archtest.o
	$(CC) $(LDFLAGS) -o $@ $(OBJS) archtest.o

clean:
	rm -f *.o $(OBJS) core a.out

clobber:	clean
	rm -f loader ttyload archtest $(ARCHLINKS)

# install, gently.  not much to it:
install:	$(PROGRAMS)
	/bin/cp ttyload ${INSTALLDIR}/ttyload

# because different systems' make have different behaviors on how they
# deal with building stuff in subdirectories, and because I don't feel
# like descending into the subdirectories to make a single object file,
# I'll force the .c.o rule to what I'm expecting:
.c.o:
	$(CC) $(CFLAGS) -o $@ -c $<