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