Enabled VPATH feature: changed nearly all Makefiles (149 files).
[fw/sdcc] / sim / ucsim / gui.src / Makefile.in
index a1ba94ad69bbb35dc765371953e836dd5ba18148..ac1dcba053f621ede5c5db1d616fc1031c3d6eae 100644 (file)
@@ -11,15 +11,17 @@ CXXCPP              = @CXXCPP@
 RANLIB         = @RANLIB@
 INSTALL                = @INSTALL@
 
-PRJDIR         = ..
+top_builddir   = @top_builddir@
+top_srcdir     = @top_srcdir@
 
 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
-CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR)
+CPPFLAGS        = @CPPFLAGS@ -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) \
+                 -I$(top_srcdir)/sim.src -I$(top_srcdir)/cmd.src
 CFLAGS          = @CFLAGS@ -Wall
 CXXFLAGS        = @CXXFLAGS@ -Wall
 M_OR_MM         = @M_OR_MM@
 
-LIBS           = @LIBS@ -L$(PRJDIR) -lutil -lsim -lcmd
+LIBS           = @LIBS@ @CURSES_LIBS@ -L$(top_builddir)
 
 curses_ok      = @curses_ok@
 
@@ -34,70 +36,105 @@ man1dir         = $(mandir)/man1
 man2dir         = $(mandir)/man2
 infodir         = @infodir@
 srcdir          = @srcdir@
+VPATH           = @srcdir@
 
-PKGS           = serio.src portmon.src
+enable_serio   = @enable_serio@
+PKGS           =
+ifeq ($(enable_serio),yes)
+SERIO_PKG      = serio.src
+else
+SERIO_PKG      =
+endif
+CURSES_PKGS    = $(SERIO_PKG)
+
+# Common code
+OBJECTS                = rec.o
+SOURCES                = $(patsubst %.o,%.cc,$(OBJECTS))
+
+# uCsim only
+UCSIM_OBJECTS  = gui.o if.o
+UCSIM_SOURCES  = $(patsubst %.o,%.cc,$(UCSIM_OBJECTS))
 
-LOBJECTS       = event.o \
-                 view.o frame.o bg.o label.o \
-                 group.o win.o desk.o app.o
+# Tool only
+TOOL_OBJECTS   =
+TOOL_SOURCES   = $(patsubst %.o,%.cc,$(TOOL_OBJECTS))
+
+ALL_SOURCES    = $(SOURCES) $(UCSIM_SOURCES) $(TOOL_SOURCES)
 
 
 # Compiling entire program or any subproject
 # ------------------------------------------
 all: gui.src
 
-libs: guilib
-
+gui.src: checkconf gui_api
 ifeq ($(curses_ok),yes)
-gui.src: checkconf guilib a
-else
-gui.src: checkconf guilib
-endif
-       @for pkg in $(PKGS); do\
-         $(MAKE) -C $$pkg $$pkg ;\
+       @for pkg in dummy $(CURSES_PKGS); do\
+         if test -f $$pkg/Makefile; then $(MAKE) -C $$pkg $$pkg; else : ; fi ;\
        done
+endif
+#      @for pkg in $(PKGS); do\
+#        $(MAKE) -C $$pkg $$pkg ;\
+#      done
 
-a: a.o
-       $(CXX) $(LDFLAGS) a.o -o $@ $(LIBS)
+gui_api: ucsim_lib tool_lib
 
 
 # Compiling and installing everything and runing test
 # ---------------------------------------------------
-install:
-       @for pkg in $(PKGS); do\
-         cd $$pkg && $(MAKE) install ; cd ..;\
+install: install_gui_api
+ifeq ($(curses_ok),yes)
+       @for pkg in $(CURSES_PKGS); do\
+         $(MAKE) -C $$pkg install ; cd ..;\
        done
+endif
+
+install_gui_api:
 
 
 # Deleting all the installed files
 # --------------------------------
-uninstall:
-       @for pkg in $(PKGS); do\
-         cd $$pkg && $(MAKE) uninstall ; cd ..;\
+uninstall: uninstall_gui_api
+ifeq ($(curses_ok),yes)
+       @for pkg in $(CURSES_PKGS); do\
+         $(MAKE) -C $$pkg uninstall ; cd ..;\
        done
+endif
+
+uninstall_gui_api:
 
 
 # Performing self-test
 # --------------------
-check:
-       @for pkg in $(PKGS); do\
-         cd $$pkg && $(MAKE) check ; cd ..;\
+check: check_local
+       @for pkg in $(CURSES_PKGS); do\
+         $(MAKE) -C $$pkg check ; cd ..;\
+       done
+
+check_local:
+
+test: test_local
+       @for pkg in $(CURSES_PKGS); do\
+         $(MAKE) -C $$pkg test ; cd ..;\
        done
 
+test_local:
+
 
 # Performing installation test
 # ----------------------------
-installcheck:
-       @for pkg in $(PKGS); do\
-         cd $$pkg && $(MAKE) installcheck ; cd ..;\
+installcheck: installcheck_gui_api
+       @for pkg in $(CURSES_PKGS); do\
+         $(MAKE) -C $$pkg installcheck ; cd ..;\
        done
 
+installcheck_gui_api:
+
 
 # Creating installation directories
 # ---------------------------------
 installdirs:
-       @for pkg in $(PKGS); do\
-         cd $$pkg && $(MAKE) installdirs ; cd ..;\
+       @for pkg in $(CURSES_PKGS); do\
+         $(MAKE) -C $$pkg installdirs ; cd ..;\
        done
 
 
@@ -105,26 +142,32 @@ installdirs:
 # ---------------------
 dep: Makefile.dep
 
-Makefile.dep: *.cc *.h
-       $(CXXCPP) $(CPPFLAGS) $(M_OR_MM) *.cc >Makefile.dep
-
-include Makefile.dep
-include clean.mk
+Makefile.dep: $(ALL_SOURCES) $(srcdir)/*.h
+       $(CXXCPP) -MM $(CPPFLAGS) $(M_OR_MM) $^ >Makefile.dep
 
-#parser.cc: parser.y
+# don't include Makefile.dep for the listed targets:
+ifeq "$(findstring $(MAKECMDGOALS),uninstall uninstall_gui_api \
+                                   check check_local test test_local \
+                                   checkconf \
+                                   clean_local clean distclean_local \
+                                   distclean mostlyclean realclean)" ""
+  include Makefile.dep
+endif
+include $(srcdir)/clean.mk
 
-#plex.cc: plex.l
 
 # My rules
 # --------
-ifeq ($(curses_ok),yes)
-guilib: libgui.a
-else
-guilib:
-endif
+ucsim_lib: $(top_builddir)libguiucsim.a
+
+$(top_builddir)libguiucsim.a: $(OBJECTS) $(UCSIM_OBJECTS)
+       ar -rcu $*.a $(OBJECTS) $(UCSIM_OBJECTS)
+       $(RANLIB) $*.a
+
+tool_lib: $(top_builddir)libguitool.a
 
-libgui.a: $(LOBJECTS)
-       ar -rcu $*.a $(LOBJECTS)
+$(top_builddir)libguitool.a: $(OBJECTS) $(TOOL_OBJECTS)
+       ar -rcu $*.a $(OBJECTS) $(TOOL_OBJECTS)
        $(RANLIB) $*.a
 
 .cc.o:
@@ -134,8 +177,8 @@ libgui.a: $(LOBJECTS)
 # Remaking configuration
 # ----------------------
 checkconf:
-       @if [ -f $(PRJDIR)/devel ]; then\
-         $(MAKE) -f conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" freshconf;\
+       @if [ -f $(top_builddir)devel ]; then\
+         $(MAKE) -f conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" freshconf;\
        fi
 
 # End of gui.src/Makefile