File: Make_lib

package info (click to toggle)
libtsp 3r0-1
  • links: PTS
  • area: non-free
  • in suites: potato, woody
  • size: 5,096 kB
  • ctags: 1,798
  • sloc: ansic: 14,464; sh: 1,217; makefile: 182
file content (60 lines) | stat: -rw-r--r-- 1,348 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
#
#  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 1.19 1997/05/21 libtsp-v3r0 $

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 clean

# 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) $?

# clean up object files
clean:
	rm -f $(OBJECTS)

# 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 $@