File: Makefile

package info (click to toggle)
psignifit 2.5.6-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 520 kB
  • ctags: 550
  • sloc: ansic: 5,317; sh: 96; makefile: 88
file content (75 lines) | stat: -rwxr-xr-x 2,042 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
SHELL = /bin/sh

# stage 2:
# CYGFLAG, DBFLAG and OUTDIR are all specified as constants within the makefile.
# The finished target turns ends up in OUTDIR, but the .o and .d  files are still
# mixed in with the source, and are given the same names even irrespective of
# CYGFLAG and DBFLAG.

# configure paths for Debian GNU/Linux
BINPATH=$(DESTDIR)/usr/bin

CYGFLAG =
DBFLAG  = -g

CC = gcc
CFLAGS = $(CYGFLAG) $(DBFLAG)
CXX = g++
CXXFLAGS = $(CYGFLAG) $(DBFLAG)
LD = gcc $(CYGFLAG) $(DBFLAG)
# add '-lm' flag for Debian GNU/Linux
LDFLAGS = -lm
DEPEND_FLAG = -MM  # GNU compilers support -MM, others may only support -M

csource = $(wildcard *.c)
cppsource = $(wildcard *.cpp)
objects = $(csource:.c=.o) $(cppsource:.cpp=.o)
dependencies = $(objects:.o=.d)

# to put .o, .d in separate directory: when creating $(objects),
# do an additional pattern replace on objects so that $(OBJDIR)/
# is prefixed and -$(STEM) is inserted before the .o
# $(OBJDIR) and $(STEM) must then be taken into account in the %.d rules below


.PHONY: clean gnu dos mex gnu-db mex-db dos-db

gnu : psignifit

# gnu, gnu-db
# win, win-db
# mex, mex-db
# targets should be able to override $(STEM), $(CYGFLAG) and $(DBFLAG) accordingly
# $(STEM) should be equal to the target name, reflecting both the target and the debug
# status - then the only thing left ambiguous is the finished filename, and that can
# easily be forced to update using a flag to make


psignifit : $(objects)
	$(LD) $(LDFLAGS) -o $@ $(objects)

%.d : %.c
	@ set -e; $(CC) $(DEPEND_FLAG) $(CFLAGS) $< \
	| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
	[ -s $@ ] || rm -f $@

%.d : %.cpp
	@ set -e; $(CXX) $(DEPEND_FLAG) $(CXXFLAGS) $< \
	| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
	[ -s $@ ] || rm -f $@

include $(dependencies)

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cpp
	$(CXX) $(CXXFLAGS) -c $< -o $@

clean :
	@ -rm $(objects) $(dependencies)
	@ -rm psignifit

# added install target for Debian GNU/Linux
install: psignifit
	install -d $(BINPATH)
	install ./psignifit $(BINPATH)