6abe0993e78452adfeeafea3a3ffb50c7a5994bf
[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 LIBS            = @LIBS@
30
31 prefix          = @prefix@
32 exec_prefix     = @exec_prefix@
33 bindir          = @bindir@
34 libdir          = @libdir@
35 datadir         = @datadir@
36 includedir      = @includedir@
37 mandir          = @mandir@
38 man1dir         = $(mandir)/man1
39 man2dir         = $(mandir)/man2
40 infodir         = @infodir@
41 srcdir          = @srcdir@
42
43 OBJECTS         = pobj.o globals.o utils.o
44 SOURCES         = $(patsubst %.o,%.cc,$(OBJECTS))
45 UCSIM_OBJECTS   = ucsim.o
46 UCSIM_SOURCES   = $(patsubst %.o,%.cc,$(UCSIM_OBJECTS))
47 ALL_SOURCES     = $(SOURCES) $(UCSIM_SOURCES)
48
49
50 # Compiling entire program or any subproject
51 # ------------------------------------------
52 all: checkconf libs
53
54 libs: libutil.a
55
56 main_app: checkconf ucsim_app
57
58 # Compiling and installing everything and runing test
59 # ---------------------------------------------------
60 install: all installdirs
61
62
63 # Deleting all the installed files
64 # --------------------------------
65 uninstall:
66         rm -f $(bindir)/s51
67         rm -f $(bindir)/savr
68         rm -f $(bindir)/serialview
69         rm -f $(bindir)/portmon
70
71
72 # Performing self-test
73 # --------------------
74 check:
75
76
77 # Performing installation test
78 # ----------------------------
79 installcheck:
80
81
82 # Creating installation directories
83 # ---------------------------------
84 installdirs:
85
86
87 # Creating dependencies
88 # ---------------------
89 dep: main.dep
90
91 main.dep: $(ALL_SOURCES) *.h
92         $(CXXCPP) $(CPPFLAGS) $(M_OR_MM) $(ALL_SOURCES) >main.dep
93
94 include main.dep
95 include clean.mk
96
97 #parser.cc: parser.y
98
99 #plex.cc: plex.l
100
101 # My rules
102 # --------
103 libutil.a: $(OBJECTS)
104         ar -rcu $*.a $(OBJECTS)
105         $(RANLIB) $*.a
106
107 ucsim_app: libs ucsim
108
109 ucsim: $(UCSIM_OBJECTS) $(UCSIM_LIB_FILES)
110         $(CXX) $(CXXFLAGS) -o $@ $< -L$(PRJDIR) $(UCSIM_LIBS) $(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