1 |
#$Id: Makefile.defaults,v 1.1.1.1 1999/08/23 13:34:36 tis4000 Exp $ |
2 |
|
3 |
# |
4 |
# Makefile.defaults |
5 |
# |
6 |
# this file contains 'standard' definitions of various things |
7 |
# required by Makefiles in the '.../Vx/xxx' build tree. Any |
8 |
# changes here will affect ALL subordinate Makefiles and will |
9 |
# cause the auto-regeneration of all the Makefile.Mxx scripts. |
10 |
# |
11 |
|
12 |
# CPU,BSP,FLT,CUR,DST,TARG,GCC_BASE,CPU_FAM input from command line for make depend |
13 |
# e.g. |
14 |
# CPU=68000 |
15 |
# BSP=msol,mv147 |
16 |
# FLT=soft-float,68881,""(X86 hardware default) |
17 |
# CUR=rec |
18 |
# DST=M00,M30,X486 |
19 |
# TARG=68k,386 |
20 |
# GCC_BASE=68K,386 |
21 |
# CPU_FAM=MC68000,MC68030,I80486 |
22 |
|
23 |
# |
24 |
# 'TOP' is relative to '.../Vx/xxx' so as to be on the |
25 |
# correct sibling level with the "bin" directories '.../Vx/Mnn' - |
26 |
# this facilitates debugging with relative paths |
27 |
# |
28 |
|
29 |
TOP = ..\..\.. |
30 |
SHR = $(TOP)/share |
31 |
VXW = $(SHR)/vw$(GCC_BASE) |
32 |
|
33 |
# --- |
34 |
# environment variables required by GNU/WRS tools |
35 |
# |
36 |
|
37 |
EV1 = VX_HOST_TYPE=sun4 |
38 |
$(EV1) |
39 |
EV2 = VX_HSP_BASE=$(VXW) |
40 |
$(EV2) |
41 |
EV3 = VX_BSP_BASE=$(VXW) |
42 |
$(EV3) |
43 |
EV4 = VX_VW_BASE=$(VXW) |
44 |
$(EV4) |
45 |
EV5 = GCC_$(GCC_BASE)_BASE=$(VX_VW_BASE)/gnu-toolkit |
46 |
$(EV5) |
47 |
EV6 = GCC_EXEC_PREFIX=$(GCC_$(GCC_BASE)_BASE)/$(VX_HOST_TYPE).$(TARG)/lib/gcc-lib/ |
48 |
$(EV6) |
49 |
|
50 |
ENV = $(EV1) $(EV2) $(EV3) $(EV4) $(EV5) $(EV6) |
51 |
GPATH = $(ENV) $(GCC_$(GCC_BASE)_BASE)/$(VX_HOST_TYPE).$(TARG)/bin |
52 |
TLBIN = $(VX_VW_BASE)/bin/$(VX_HOST_TYPE) |
53 |
|
54 |
# --- |
55 |
# directory alias macros |
56 |
# |
57 |
|
58 |
SRCRT = $(SHR)/src |
59 |
BINRT = $(TOP)/Vx |
60 |
CFG = $(VXW)/config/$(BSP) |
61 |
SRC = $(SRCRT)/$(CUR) |
62 |
|
63 |
# --- |
64 |
# include paths |
65 |
# |
66 |
# extra include directories for a given '.../Vx/xxx' should |
67 |
# be defined in the Makefile.config file for that target by |
68 |
# setting the INX macro to a non-empty value |
69 |
# |
70 |
|
71 |
STDH = $(VXW)/h |
72 |
TISH = $(SHR)/epicsH |
73 |
INC = -I$(STDH) -I$(TISH) -I$(SRC) -I$(VXW)/h/sys -I$(VXW)/h/netinet |
74 |
|
75 |
# --- |
76 |
# final bindings for the tool invocations ... modify with care! |
77 |
# |
78 |
|
79 |
MF = Makefile.$(DST) |
80 |
68KOPT = -m$(FLT) -pipe -fno-builtin -traditional -O -g |
81 |
386OPT = -pipe -fno-builtin -traditional -O -g |
82 |
CC = $(GPATH)/cc$(TARG) -c -m$(CPU) -DCPU=$(CPU_FAM) $($(GCC_BASE)OPT) $($(DST)OPT) $(INC) $($(DST)INX) $($(DST)CCX) |
83 |
LD = $(GPATH)/ld$(TARG) -r |
84 |
|
85 |
# |
86 |
# seriously get down to business... |
87 |
# |
88 |
|
89 |
.SUFFIXES: |
90 |
|
91 |
.SUFFIXES: .s .c .o |
92 |
|
93 |
# |
94 |
# *F = filename part of current dependency |
95 |
# so we are creating a variable CCX = CCX_iocInit which is to be defined in target dir |
96 |
# Makefile.config, see db |
97 |
# for CCY we are creating M00CCX_iocInit (M00 from DST), used for flag for file for specific |
98 |
# machine type in this case M00 |
99 |
# the set command makes arg 1 (source path to source file), 2 and 3 are additional compile flags |
100 |
# $@ is the current target ex iocInit.o |
101 |
# |
102 |
|
103 |
%.o : |
104 |
@ CCX="$(CCX_$(*F))" ; CCY="$($(DST)CCX_$(*F))" ; set $(SRC)/$(*F) "$${CCX:-} $${CCY:-}" ; \ |
105 |
if test -f $$1.c ; then \ |
106 |
echo "compiling '$$1.c' to '$@' ... $$2" ; $(RM) $@ ; \ |
107 |
$(CC) -o $@ $$1.c $$2 ; \ |
108 |
elif test -f $$1.s ; then \ |
109 |
echo "translating '$$1.s' to '$@' ... $$2" ; $(RM) $@ ; \ |
110 |
cat $$1.s >$(*F).S ; $(CC) -o $@ $(*F).S $$2 ; $(RM) $(*F).S ; \ |
111 |
else \ |
112 |
echo "-- MAJOR SNAFU! -- ($$1) -> ($@)" ; \ |
113 |
fi |
114 |
|
115 |
# --- |
116 |
# the 'default' target will be executed when the Makefile.Mxx is called |
117 |
# without any parameters ... we refer it to the 'user_target' defined |
118 |
# in Makefile.target. |
119 |
# |
120 |
# the 'depend' entry point for generating the dependencies in a given |
121 |
# tree for a specific processor is the name of the desired Makefile.Mxx |
122 |
# |
123 |
|
124 |
# --- |
125 |
# gather 'uniqueness', i.e. list of sources, for current directory |
126 |
# |
127 |
|
128 |
include ../Makefile.config |
129 |
|
130 |
default: user_target |
131 |
@ echo "finished $(CUR)/$(DST)." |
132 |
|
133 |
$(MF): ../../Makefile.defaults ../Makefile.config ../Makefile.target |
134 |
@ echo "updating '$(CUR)/$(DST)/Makefile.$(DST)' ..." |
135 |
@ $(RM) $(MF) ; touch $(MF) |
136 |
@ echo "#" >> $(MF) ; echo "# Specified configuration:" >> $(MF) ; echo "#" >> $(MF) |
137 |
@ echo "CPU = " $(CPU) >> $(MF) ; echo "FLT = " $(FLT) >> $(MF) ; echo "BSP = " $(BSP) >> $(MF) |
138 |
@ echo "CUR = " $(CUR) >> $(MF) ; echo "DST = " $(DST) >> $(MF) ; echo "TARG = " $(TARG) >> $(MF) |
139 |
@ echo "GCC_BASE = " $(GCC_BASE) >> $(MF) ; echo "CPU_FAM = " $(CPU_FAM) >> $(MF) |
140 |
@ cat ../../Makefile.defaults ../Makefile.target >> $(MF) |
141 |
@ $(CC) -M $(SRCS) | sed >> $(MF) \ |
142 |
-e '/\.\.\/\.\.\/\.\.\/share\/epicsH/s||\$$\(TISH\)|g' \ |
143 |
-e '/\.\.\/\.\.\/\.\.\/share\/vw$(GCC_BASE)\/h/s||\$$\(STDH\)|g' \ |
144 |
-e '/\.\.\/\.\.\/\.\.\/share\/src\/$(CUR)/s||\$$\(SRC\)|g' \ |
145 |
# --- |
146 |
# |
147 |
# END of Makefile.defaults |
148 |
# |