* device/lib/pic16/Makefile.common.in: added $(MM) to fix `make clean`
[fw/sdcc] / sim / ucsim / avr.src / Makefile.in
index 775edcaa9a9ad8c9ebbd50e179300b57955d767f..190cf434b12b1d8f752af21afb50e0aa3106428b 100644 (file)
@@ -17,12 +17,17 @@ 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 -lsim -lutil -lcmd -lguiucsim -Wl,--end-group
+DL             = @DL@
+dl_ok          = @dl_ok@
 
 prefix          = @prefix@
 exec_prefix     = @exec_prefix@
@@ -36,38 +41,43 @@ man2dir         = $(mandir)/man2
 infodir         = @infodir@
 srcdir          = @srcdir@
 
-OBJECTS         = savr.o glob.o \
+OBJECTS_SHARED = glob.o \
                  simavr.o avr.o port.o \
                  inst.o bit_inst.o jump_inst.o move_inst.o logic_inst.o \
                  arith_inst.o
+OBJECTS_EXE    = savr.o
+OBJECTS                = $(OBJECTS_SHARED) $(OBJECTS_EXE)
+
+enable_dlso    = @enable_dlso@
+dlso_ok                = @dlso_ok@
 
 AVRASM         = tavrasm
 TEST_OBJ       = test_bit.hex test_dis.hex test_mov.hex test_jmp.hex \
-                 test_arith.hex
+                 test_arith.hex test_call.hex
 
 
 # Compiling entire program or any subproject
 # ------------------------------------------
-all: checkconf otherlibs avr.src tests
-
-tests: $(TEST_OBJ)
+all: checkconf otherlibs avr.src
 
 
 # Compiling and installing everything and runing test
 # ---------------------------------------------------
 install: all installdirs
-       $(INSTALL) -s savr $(bindir)
+       $(INSTALL) -s savr$(EXEEXT) $(DESTDIR)$(bindir)
 
 
 # Deleting all the installed files
 # --------------------------------
 uninstall:
-       rm -f $(bindir)/savr
+       rm -f $(DESTDIR)$(bindir)/savr
 
 
 # Performing self-test
 # --------------------
-check:
+check: $(TEST_OBJ)
+
+test:
 
 
 # Performing installation test
@@ -78,7 +88,7 @@ installcheck:
 # Creating installation directories
 # ---------------------------------
 installdirs:
-       test -d $(bindir) || $(INSTALL) -d $(bindir)
+       test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir)
 
 
 # Creating dependencies
@@ -99,10 +109,21 @@ include clean.mk
 # --------
 .SUFFIXES: .asm .hex
 
-avr.src: savr
+avr.src: savr$(EXEEXT) shared_lib
+
+savr$(EXEEXT): $(OBJECTS) $(PRJDIR)/*.a
+       $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $@
+
+ifeq ($(dlso_ok),yes)
+shared_lib: $(PRJDIR)/savr.so
+else
+shared_lib:
+       @$(PRJDIR)/mkecho $(PRJDIR) "No AVR shared lib made."
+       @$(PRJDIR)/mkecho $(PRJDIR) "(SHAREDLIB="$(SHAREDLIB)",dl_ok="$(dl_ok)",enable_dlso="$(enable_dlso)")"
+endif
 
-savr: $(OBJECTS) $(PRJDIR)/*.a
-       $(CXX) $(CXXFLAGS) -o savr $(OBJECTS) $(LIBS)
+$(PRJDIR)/savr.so: $(OBJECTS_SHARED)
+       $(CXX) -shared $(OBJECTS_SHARED) -o $(PRJDIR)/savr.so
 
 otherlibs:
        cd $(PRJDIR)/cmd.src && $(MAKE) all