Version 0.3.2-pre1
[fw/sdcc] / sim / ucsim / main_in.mk
1 #
2 # S51 main.mk
3 #
4 # (c) Drotos Daniel, Talker Bt. 1997,99
5 #
6
7 STARTYEAR       = 1997
8
9 SHELL           = /bin/sh
10 CXX             = @CXX@
11 #CPP            = @CPP@
12 CXXCPP          = @CXXCPP@
13 RANLIB          = @RANLIB@
14 INSTALL         = @INSTALL@
15
16 PRJDIR          = .
17 SIMDIR          = sim.src
18
19 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
20 # FIXME: -Imcs51 must be removed!!!
21 CPPFLAGS        = @CPPFLAGS@ -I$(PRJDIR) -I$(PRJDIR)/$(SIMDIR)
22 CFLAGS          = @CFLAGS@ -I$(PRJDIR) -Wall
23 CXXFLAGS        = @CXXFLAGS@ -I$(PRJDIR) -Wall
24 M_OR_MM         = @M_OR_MM@
25
26 LIB_LIST        = sim cmd sim util
27 UCSIM_LIBS      = $(patsubst %,-l%,$(LIB_LIST))
28 UCSIM_LIB_FILES = $(patsubst %,lib%.a,$(LIB_LIST))
29
30 prefix          = @prefix@
31 exec_prefix     = @exec_prefix@
32 bindir          = @bindir@
33 libdir          = @libdir@
34 datadir         = @datadir@
35 includedir      = @includedir@
36 mandir          = @mandir@
37 man1dir         = $(mandir)/man1
38 man2dir         = $(mandir)/man2
39 infodir         = @infodir@
40 srcdir          = @srcdir@
41
42 OBJECTS         = pobj.o globals.o utils.o
43 SOURCES         = $(patsubst %.o,%.cc,$(OBJECTS))
44 UCSIM_OBJECTS   = ucsim.o
45 UCSIM_SOURCES   = $(patsubst %.o,%.cc,$(UCSIM_OBJECTS))
46 ALL_SOURCES     = $(SOURCES) $(UCSIM_SOURCES)
47
48
49 # Compiling entire program or any subproject
50 # ------------------------------------------
51 all: checkconf libs
52
53 libs: libutil.a
54
55 main_app: checkconf ucsim_app
56
57 # Compiling and installing everything and runing test
58 # ---------------------------------------------------
59 install: all installdirs
60
61
62 # Deleting all the installed files
63 # --------------------------------
64 uninstall:
65         rm -f $(bindir)/s51
66         rm -f $(bindir)/savr
67         rm -f $(bindir)/serialview
68         rm -f $(bindir)/portmon
69
70
71 # Performing self-test
72 # --------------------
73 check:
74
75
76 # Performing installation test
77 # ----------------------------
78 installcheck:
79
80
81 # Creating installation directories
82 # ---------------------------------
83 installdirs:
84
85
86 # Creating dependencies
87 # ---------------------
88 dep: main.dep
89
90 main.dep: $(ALL_SOURCES) *.h
91         $(CXXCPP) $(CPPFLAGS) $(M_OR_MM) $(ALL_SOURCES) >main.dep
92
93 include main.dep
94 include clean.mk
95
96 #parser.cc: parser.y
97
98 #plex.cc: plex.l
99
100 # My rules
101 # --------
102 libutil.a: $(OBJECTS)
103         ar -rcu $*.a $(OBJECTS)
104         $(RANLIB) $*.a
105
106 ucsim_app: libs ucsim
107
108 ucsim: $(UCSIM_OBJECTS) $(UCSIM_LIB_FILES)
109         echo $(UCSIM_LIB_FILES)
110         $(CXX) $(CXXFLAGS) -o $@ $< -L$(PRJDIR) $(UCSIM_LIBS)
111
112 .cc.o:
113         $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
114
115 .y.cc:
116         rm -f $*.cc $*.h
117         $(YACC) -d $<
118         mv y.tab.c $*.cc
119         mv y.tab.h $*.h
120
121 .l.cc:
122         rm -f $*.cc
123         $(LEX) -t $< >$*.cc
124
125
126 # Remaking configuration
127 # ----------------------
128 checkconf:
129         @if [ -f devel ]; then\
130           echo "MAIN.MK checkconf";\
131           $(MAKE) -f conf.mk srcdir="$(srcdir)" freshconf;\
132         fi
133
134 # End of main_in.mk/main.mk