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