* device/lib/pic16/Makefile.common.in: added $(MM) to fix `make clean`
[fw/sdcc] / sim / ucsim / z80.src / Makefile.in
index c5ff13314576649c645e05add28707388c1fd8ed..2f5077994cab30d071146aa820829ef304606318 100644 (file)
@@ -17,12 +17,18 @@ PRJDIR              = ..
 
 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
 CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) \
-                 -I$(PRJDIR)/cmd.src -I$(PRJDIR)/sim.src
+                 -I$(PRJDIR)/cmd.src -I$(PRJDIR)/sim.src -I$(PRJDIR)/gui.src
 CFLAGS          = @CFLAGS@ -Wall
 CXXFLAGS        = @CXXFLAGS@ -Wall
 M_OR_MM         = @M_OR_MM@
+PICOPT         = @PICOPT@
+SHAREDLIB      = @SHAREDLIB@
+EXEEXT         = @EXEEXT@
 
-LIBS           = @LIBS@ -L$(PRJDIR) -lsim -lcmd -lutil
+LIBS           = @LIBS@ -L$(PRJDIR) -Wl,--start-group -lutil -lcmd -lsim -lguiucsim -Wl,--end-group
+
+DL             = @DL@
+dl_ok          = @dl_ok@
 
 prefix          = @prefix@
 exec_prefix     = @exec_prefix@
@@ -36,15 +42,26 @@ man2dir         = $(mandir)/man2
 infodir         = @infodir@
 srcdir          = @srcdir@
 
-OBJECTS         = sz80.o glob.o \
+OBJECTS_SHARED = glob.o \
                  inst.o \
+                 inst_cb.o \
+                 inst_dd.o \
+                 inst_ed.o \
+                 inst_fd.o \
+                 inst_ddcb.o \
+                 inst_fdcb.o \
                  simz80.o z80.o
+OBJECTS_EXE    = sz80.o
+OBJECTS                = $(OBJECTS_SHARED) $(OBJECTS_EXE)
 
 Z80ASM         = 
+
+enable_dlso    = @enable_dlso@
+dlso_ok                = @dlso_ok@
+
 #TEST_OBJ      = test_bit.hex test_dis.hex test_mov.hex test_jmp.hex \
 #                test_arith.hex
 
-
 # Compiling entire program or any subproject
 # ------------------------------------------
 all: checkconf otherlibs z80.src tests
@@ -55,18 +72,20 @@ tests: $(TEST_OBJ)
 # Compiling and installing everything and runing test
 # ---------------------------------------------------
 install: all installdirs
-       $(INSTALL) -s sz80 $(bindir)
+       $(INSTALL) -s sz80$(EXEEXT) $(DESTDIR)$(bindir)
 
 
 # Deleting all the installed files
 # --------------------------------
 uninstall:
-       rm -f $(bindir)/sz80
+       rm -f $(DESTDIR)$(bindir)/sz80$(EXEEXT)
 
 
 # Performing self-test
 # --------------------
-check:
+check: test
+
+test:
 
 
 # Performing installation test
@@ -77,7 +96,7 @@ installcheck:
 # Creating installation directories
 # ---------------------------------
 installdirs:
-       test -d $(bindir) || $(INSTALL) -d $(bindir)
+       test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir)
 
 
 # Creating dependencies
@@ -94,10 +113,21 @@ include clean.mk
 # --------
 .SUFFIXES: .asm .hex
 
-z80.src: sz80
+z80.src: sz80$(EXEEXT) shared_lib
+
+sz80$(EXEEXT): $(OBJECTS) $(PRJDIR)/*.a
+       $(CXX) $(CXXFLAGS) -o $@ $(OBJECTS) $(LIBS)
+
+ifeq ($(dlso_ok),yes)
+shared_lib: $(PRJDIR)/sz80.so
+else
+shared_lib:
+       @$(PRJDIR)/mkecho $(PRJDIR) "No z80 shared lib made."
+       @$(PRJDIR)/mkecho $(PRJDIR) "(SHAREDLIB="$(SHAREDLIB)",dl_ok="$(dl_ok)",enable_dlso="$(enable_dlso)")"
+endif
 
-sz80: $(OBJECTS) $(PRJDIR)/*.a
-       $(CXX) $(CXXFLAGS) -o sz80 $(OBJECTS) $(LIBS)
+$(PRJDIR)/sz80.so: $(OBJECTS_SHARED)
+       $(CXX) -shared $(OBJECTS_SHARED) -o $(PRJDIR)/sz80.so
 
 otherlibs:
        cd $(PRJDIR)/cmd.src && $(MAKE) all