File: make.common

package info (click to toggle)
saml 970418-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,204 kB
  • ctags: 1,701
  • sloc: ansic: 17,182; sh: 2,583; yacc: 497; perl: 264; makefile: 250; python: 242
file content (110 lines) | stat: -rw-r--r-- 3,297 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# make.common: definitions and rules common to all makefiles.

#################################################################
#
# Common definitions
#
#################################################################

# Where libraries and common headers live
INCDIR := $(TOPDIR)/lib
LIBDIR := $(TOPDIR)/lib

# The compiler; it must be gcc 2.5.0 or later.
CC = cc

# Optimization options (this is for Linux on Intel machines). If you don't
# care about debugging, you can get a significant performance improvement
# by adding `-fomit-frame-pointer' since many functions are very small.
#OPTIM = -O2 -m486 -fomit-frame-pointer
OPTIM = -O2  -fomit-frame-pointer
# On sparc machines, you can add the "-mv8" option if your chip can do
# integer multiplications and divisions in hardware; this greatly improves
# the performance on big integers.
#OPTIM = -O2 -mv8

# Warning options: feel free to add others...
WARN = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings
# SunOS has pre-ANSI headers, so disable all warnings related to
# missing prototypes (at least).
#WARN =

# Symbol definitions. Some important defines are:
#
#  NDEBUG
#   Removes all assertions from the code. Not really advised, unless you
#   trust my code very much.
#
#  DEBUG_MTYPES
#   Includes debugging code related to the type system; you still need to
#   set the environment variable DEBUG_MTYPES to activate this code.
#
DEFS =
# SunOS does not define CLK_TCK. We could use sysconf(_SC_CLK_TCK) but it's
# probably overkill, since the manpages say that HZ is always 60.
#DEFS = -DCLK_TCK=60

# Debugging options. Note that this may conflict with optimizations,
# for instance you can't combine -g with -fomit-frame-pointer in most
# versions of gcc.
DEBUG = -g
# If you're not going to debug the code, just take
#DEBUG =

# You can modify these ones too:
CPPFLAGS= -I. -I$(INCDIR) $(DEFS) $(XCPPFLAGS)
CFLAGS	= -pipe $(OPTIM) $(WARN) $(XCFLAGS)
LDFLAGS	= -L. -L$(LIBDIR) $(DEBUG) $(XLDFLAGS)

# For example, if you've got gdbm(3) in a non-standard place, you may
# use something like this:
#GDBMDIR = $(TOPDIR)/../gdbm-1.7.3
#CPPFLAGS += -I$(GDBMDIR)
#LDFLAGS  += -L$(GDBMDIR)

# Ranlib, if necessary
RANLIB = ranlib
#RANLIB = true

# The parser generator. It is only necessary if you want to modify the
# parsers, or after a "make veryclean". I have tried bison, byacc and the
# yacc from SunOS; all of them work.
YACC = bison -y
#YACC = yacc

#################################################################
#
# Common rules
#
#################################################################

.PHONY: all profil clean veryclean dep

# Make sure that "all" is the default rule, but let the individual Makefiles
# define the rule themselves
all:

dep: $(CFILES) $(HFILES)
	echo "# Automatically generated dependencies, do not edit" >.depend
	$(CC) $(CPPFLAGS) -MM $(CFILES) | \
		sed 's/^\(.*\).o *:/\1.o \1.op \1.s:/' >>.depend

clean:
	rm -f *.o *.op gmon.out a.out core

$(LIBDIR)/libsaml.a:
	@echo "Rebuilding the library..."
	make -C $(LIBDIR) all

$(LIBDIR)/libsaml_p.a:
	@echo "Rebuilding the profiling library..."
	make -C $(LIBDIR) profil

%.o: %.c
	$(CC) $(CPPFLAGS) $(CFLAGS) $(DEBUG) -c $<

%.op: %.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -pg -c $< -o $@

%.s: %.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -S $<