-
Notifications
You must be signed in to change notification settings - Fork 4
/
template.mk
94 lines (70 loc) · 1.71 KB
/
template.mk
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
SHELL=/bin/sh
OS_TYPE := $(shell uname -s)
ifeq ($(OS_TYPE),AIX)
ARCH=ibmrs
CXX=/usr/bin/xlC_r -+ -Dibmrs
CC=/usr/bin/cc_r -Dibmrs
endif
ifeq ($(OS_TYPE),HP-UX)
ARCH=hppa
CXX=/opt/aCC/bin/aCC
CXXFLAGS=+DAportable -AA
BIN_LINK_FLAGS=-lPW
endif
ifeq ($(OS_TYPE),SunOS)
ARCH=sun4v
CXX=CC
CXXFLAGS=-g
endif
ifeq ($(OS_TYPE),Linux)
ARCH=lnx86
CXX=g++
CC=gcc
endif
.SUFFIXES: $(SUFFIXES) .cpp
TMP1 = $(LIBSRCS:.cpp=.o)
TMP2 = $(TMP1:.cc=.o)
LIBOBJS = $(TMP2:.c=.o)
TMP3 = $(BINSRCS:.cpp=.o)
TMP4 = $(TMP3:.cc=.o)
BINOBJS = $(TMP4:.c=.o)
all: $(LIBTARGET) $(BINTARGET)
ifdef BINTARGET
INSTALLED_BIN = ../bin/$(BINTARGET)
endif
$(INSTALLED_BIN): $(BINTARGET)
@mkdir -p ../bin
@echo $< =\> $@
@rm -f $(INSTALLED_BIN)
@cp $(BINTARGET) $(INSTALLED_BIN)
installbin: $(INSTALLED_BIN)
ifdef LIBTARGET
INSTALLED_LIB = ../lib/$(LIBTARGET)
endif
$(INSTALLED_LIB): $(LIBTARGET)
@mkdir -p ../lib
@echo $< =\> $@
@rm -f $(INSTALLED_LIB)
@cp $(LIBTARGET) $(INSTALLED_LIB)
installlib: $(INSTALLED_LIB)
install release: all installhdrs installlib installbin
INSTALLED_HDRS = $(PUBLIC_HDRS:%=../include/%)
$(INSTALLED_HDRS): ../include/%: %
@mkdir -p ../include
@echo $< =\> $@
@rm -f $@
@cp -p $< $@
installhdrs: $(INSTALLED_HDRS)
.cpp.o:
$(COMPILE.cc) -g -I../include $<
.c.o:
$(COMPILE.c) -I../include $<
$(LIBTARGET): $(LIBOBJS)
rm -f $(LIBTARGET)
$(AR) $(ARFLAGS) $(LIBTARGET) $^
$(BINTARGET): $(BINOBJS) $(LIBTARGET) $(LDLIBS)
rm -f $(BINTARGET)
$(LINK.cc) -g -o $(BINTARGET) $(BINOBJS) $(LIBTARGET) $(LDLIBS) $(BIN_LINK_FLAGS)
clean doclean:
rm -f $(LIBTARGET) $(LIBOBJS) $(BINTARGET) $(BINOBJS) $(INSTALLED_LIB) \
$(INSTALLED_BIN) $(INSTALLED_HDRS) lef.tab.c* lef.tab.h