5fae4c591254b8dd17b8442117d830a83bb002fd
[fw/sdcc] / sim / ucsim / z80.src / Makefile.in
1 #
2 # uCsim z80.src/Makefile
3 #
4 # (c) Drotos Daniel, Talker Bt. 1997
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
18 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
19 CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) \
20                   -I$(PRJDIR)/cmd.src -I$(PRJDIR)/sim.src -I$(PRJDIR)/gui.src
21 CFLAGS          = @CFLAGS@ -Wall
22 CXXFLAGS        = @CXXFLAGS@ -Wall
23 M_OR_MM         = @M_OR_MM@
24 PICOPT          = @PICOPT@
25 SHAREDLIB       = @SHAREDLIB@
26 EXEEXT          = @EXEEXT@
27
28 LIBS            = @LIBS@ -L$(PRJDIR) -lsim -lutil -lguiucsim -lcmd -lsim
29 DL              = @DL@
30 dl_ok           = @dl_ok@
31
32 prefix          = @prefix@
33 exec_prefix     = @exec_prefix@
34 bindir          = @bindir@
35 libdir          = @libdir@
36 datadir         = @datadir@
37 includedir      = @includedir@
38 mandir          = @mandir@
39 man1dir         = $(mandir)/man1
40 man2dir         = $(mandir)/man2
41 infodir         = @infodir@
42 srcdir          = @srcdir@
43
44 OBJECTS_SHARED  = glob.o \
45                   inst.o \
46                   inst_cb.o \
47                   inst_dd.o \
48                   inst_ed.o \
49                   inst_fd.o \
50                   inst_ddcb.o \
51                   inst_fdcb.o \
52                   simz80.o z80.o
53 OBJECTS_EXE     = sz80.o
54 OBJECTS         = $(OBJECTS_SHARED) $(OBJECTS_EXE)
55
56 Z80ASM          = 
57
58 enable_dlso     = @enable_dlso@
59 dlso_ok         = @dlso_ok@
60
61 #TEST_OBJ       = test_bit.hex test_dis.hex test_mov.hex test_jmp.hex \
62 #                 test_arith.hex
63
64 # Compiling entire program or any subproject
65 # ------------------------------------------
66 all: checkconf otherlibs z80.src tests
67
68 tests: $(TEST_OBJ)
69
70
71 # Compiling and installing everything and runing test
72 # ---------------------------------------------------
73 install: all installdirs
74         $(INSTALL) -s sz80$(EXEEXT) $(DESTDIR)$(bindir)
75
76
77 # Deleting all the installed files
78 # --------------------------------
79 uninstall:
80         rm -f $(DESTDIR)$(bindir)/sz80$(EXEEXT)
81
82
83 # Performing self-test
84 # --------------------
85 check: test
86
87 test:
88
89
90 # Performing installation test
91 # ----------------------------
92 installcheck:
93
94
95 # Creating installation directories
96 # ---------------------------------
97 installdirs:
98         test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir)
99
100
101 # Creating dependencies
102 # ---------------------
103 dep: Makefile.dep
104
105 Makefile.dep: *.cc *.h
106         $(CXXCPP) $(CPPFLAGS) $(M_OR_MM) *.cc >Makefile.dep
107
108 include Makefile.dep
109 include clean.mk
110
111 # My rules
112 # --------
113 .SUFFIXES: .asm .hex
114
115 z80.src: sz80$(EXEEXT) shared_lib
116
117 sz80$(EXEEXT): $(OBJECTS) $(PRJDIR)/*.a
118         $(CXX) $(CXXFLAGS) -o $@ $(OBJECTS) $(LIBS)
119
120 ifeq ($(dlso_ok),yes)
121 shared_lib: $(PRJDIR)/sz80.so
122 else
123 shared_lib:
124         @$(PRJDIR)/mkecho $(PRJDIR) "No z80 shared lib made."
125         @$(PRJDIR)/mkecho $(PRJDIR) "(SHAREDLIB="$(SHAREDLIB)",dl_ok="$(dl_ok)",enable_dlso="$(enable_dlso)")"
126 endif
127
128 $(PRJDIR)/sz80.so: $(OBJECTS_SHARED)
129         $(CXX) -shared $(OBJECTS_SHARED) -o $(PRJDIR)/sz80.so
130
131 otherlibs:
132         cd $(PRJDIR)/cmd.src && $(MAKE) all
133         cd $(PRJDIR)/sim.src && $(MAKE) all
134
135 .cc.o:
136         $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
137
138 .asm.hex:
139         $(Z80ASM) -l $< -o $@ -e $<.lst
140
141
142 # Remaking configuration
143 # ----------------------
144 checkconf:
145         @if [ -f $(PRJDIR)/devel ]; then\
146           $(MAKE) -f conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" freshconf;\
147         fi
148
149 # End of z80.src/Makefile.in