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