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