File: Make_lib

package info (click to toggle)
libtsp 2r8-1
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 4,908 kB
  • ctags: 1,409
  • sloc: ansic: 12,525; sh: 1,044; makefile: 164
file content (56 lines) | stat: -rw-r--r-- 1,294 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
#
#  Generic make commands for rebuilding a library from source files
#  For GNU make; will not work with most other make programs
#
#  Usage:
#	SOURCES = a.c b.c ...
#	LIBNAME = libtsp	# default libtsp (cc) or libuti (f77)
#       HEADERS = a.h
#	include Make_lib
#
#  Optional make variables:
#	DEFS = ...		# passed to C-preprocessor
#	libdir = ...		# library directory
#	includedir = ...	# include file directory
#
#  Environment variable:
#	tspdir			# root directory for lib and include
#				#   (default /usr/local)

# $Id: Make_lib,v 1.18 1997/03/08 libtsp-V2R8 $

include Make_kernel

# Object modules
OBJ_1 = $(SOURCES:.c=.o)
OBJ_2 = $(OBJ_1:.f=.o)
OBJECTS = $(OBJ_2:.F=.o)

LIB_MODULES = $(LIB)($(OBJECTS))

.PRECIOUS: $(LIB)
.PHONY:	lint test

# Default target: update the library
$(LIB):	$(LIB_MODULES)
	ranlib $(LIB)
	@echo $(LIB) updated

ifdef HEADERS
$(LIB_MODULES):	$(HEADERS)
endif

# run test programs
test:
	@-test -d test && cd test && $(MAKE) test

# run lint
lint:	$(SOURCES)
	$(LINT) -I$(includedir) $(LINTFLAGS) $(DEFS) $?

# implicit C compile rule with include directory and DEFS
# implicit Fortran (with preprocessor) compile rule with DEFS
.c.o:
	$(CC) -c -I$(includedir) $(CFLAGS) $(CPPFLAGS) $(DEFS) $< -o $@
.F.o:
	$(FC) -c $(FFLAGS) $(CPPFLAGS) $(DEFS) $< -o $@