* sim/ucsim/gui.src/serio.src/Makefile.in, sim/ucsim/s51.src/Makefile.in, sim/ucsim...
[fw/sdcc] / sim / ucsim / avr.src / Makefile.in
index d24280a35a2cb3452856c33bd7ab5aaf8fe82c83..f2e1ed16bd2a4abebbc10c1b2a05511568a8c990 100644 (file)
@@ -12,6 +12,7 @@ CPP           = @CPP@
 CXXCPP         = @CXXCPP@
 RANLIB         = @RANLIB@
 INSTALL                = @INSTALL@
+STRIP          = @STRIP@
 
 PRJDIR         = ..
 
@@ -21,8 +22,13 @@ CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) \
 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 -lguiucsim
+LIBS           = @LIBS@ -L$(PRJDIR) -lsim -lutil -lguiucsim -lcmd -lsim
+DL             = @DL@
+dl_ok          = @dl_ok@
 
 prefix          = @prefix@
 exec_prefix     = @exec_prefix@
@@ -36,10 +42,15 @@ 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 \
@@ -50,24 +61,25 @@ TEST_OBJ    = test_bit.hex test_dis.hex test_mov.hex test_jmp.hex \
 # ------------------------------------------
 all: checkconf otherlibs avr.src
 
-tests: $(TEST_OBJ)
-
 
 # Compiling and installing everything and runing test
 # ---------------------------------------------------
 install: all installdirs
-       $(INSTALL) -s savr $(bindir)
+       $(INSTALL) savr$(EXEEXT) $(DESTDIR)$(bindir)/savr$(EXEEXT)
+       $(STRIP) $(DESTDIR)$(bindir)/savr$(EXEEXT)
 
 
 # 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 +90,7 @@ installcheck:
 # Creating installation directories
 # ---------------------------------
 installdirs:
-       test -d $(bindir) || $(INSTALL) -d $(bindir)
+       test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir)
 
 
 # Creating dependencies
@@ -99,10 +111,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