Support alternate source directory
authorJohn Carr <jfc@mit.edu>
Wed, 25 Mar 1992 15:05:27 +0000 (15:05 +0000)
committerJohn Carr <jfc@mit.edu>
Wed, 25 Mar 1992 15:05:27 +0000 (15:05 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2268 dc483132-0cff-0310-8789-dd5450dbe970

src/config/Imake.rules
src/config/Imake.tmpl
src/config/Project.tmpl
src/kdc/Imakefile
src/lib/krb5/error_tables/Imakefile

index 1a164901103e0bc91d3eeb025e38f4ec6adb381d..c6570fe93f3e9d3ceca246960023e98cd37bdc2a 100644 (file)
@@ -570,7 +570,7 @@ target:: $(IMAKE) Imakefile
 #ifndef BuildMakefileTarget
 #define        BuildMakefileTarget(imakefile,imakeflags)                       @@\
 ImakeDependency(Makefile)                                              @@\
-       $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) imakeflags -s Makefile.new @@\
+       $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)  -f$(SRCDIR)Imakefile imakeflags -s Makefile.new @@\
        $(MAKE) -f Makefile.new noop                                    @@\
        -@if [ -f Makefile ]; then \                                    @@\
                echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ @@\
@@ -601,7 +601,7 @@ BuildMakefileTarget(Imakefile, /**/)
 #define        NormalLibraryObjectRule()                                       @@\
 .c.o:                                                                  @@\
        $(RM) $@                                                        @@\
-       $(CC) -c $(CFLAGS) $*.c
+       $(CC) -c $(CFLAGS) $(SRCDIR)$*.c
 #endif /* NormalLibraryObjectRule */
 
 #ifndef NormalFortranObjectRule
@@ -623,9 +623,9 @@ all::                                                                       @@\
                                                                        @@\
 .c.o:                                                                  @@\
        $(RM) $@ profiled/$@                                            @@\
-       $(CC) -pg -c $(CFLAGS) $*.c                                     @@\
+       $(CC) -pg -c $(CFLAGS) $(SRCDIR)$*.c                            @@\
        $(MV) $*.o profiled/$*.o                                        @@\
-       $(CC) -c $(CFLAGS) $*.c                                         @@\
+       $(CC) -c $(CFLAGS) $(SRCDIR)$*.c                                @@\
                                                                        @@\
 clean::                                                                        @@\
        -@if [ -d profiled ]; then echo "       $(RM) profiled/?*.o"; \ @@\
@@ -645,9 +645,9 @@ all::                                                                       @@\
                                                                        @@\
 .c.o:                                                                  @@\
        $(RM) $@ debugger/$@                                            @@\
-       $(CC) -g -c $(CFLAGS) $*.c                                      @@\
+       $(CC) -g -c $(CFLAGS) $(SRCDIR)$*.c                             @@\
        $(MV) $*.o debugger/$*.o                                        @@\
-       $(CC) -c $(CFLAGS) $*.c                                         @@\
+       $(CC) -c $(CFLAGS) $(SRCDIR)$*.c                                @@\
                                                                        @@\
 clean::                                                                        @@\
        -@if [ -d debugger ]; then echo "       $(RM) debugger/?*.o"; \ @@\
@@ -668,11 +668,11 @@ all::                                                                     @@\
                                                                        @@\
 .c.o:                                                                  @@\
        $(RM) $@ profiled/$@ debugger/$@                                @@\
-       $(CC) -pg -c $(CFLAGS) $*.c                                     @@\
+       $(CC) -pg -c $(CFLAGS) $(SRCDIR)$*.c                            @@\
        $(MV) $*.o profiled/$*.o                                        @@\
-       $(CC) -g -c $(CFLAGS) $*.c                                      @@\
+       $(CC) -g -c $(CFLAGS) $(SRCDIR)$*.c                             @@\
        $(MV) $*.o debugger/$*.o                                        @@\
-       $(CC) -c $(CFLAGS) $*.c                                         @@\
+       $(CC) -c $(CFLAGS) $(SRCDIR)$*.c                                @@\
                                                                        @@\
 clean::                                                                        @@\
        -@if [ -d profiled ]; then echo "       $(RM) profiled/?*.o"; \ @@\
@@ -694,9 +694,9 @@ all::                                                                       @@\
                                                                        @@\
 .c.o:                                                                  @@\
        $(RM) $@ shared/$@                                              @@\
-       $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) $*.c       @@\
+       $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c @@\
        $(MV) $*.o shared/$*.o                                          @@\
-       $(CC) -c $(SHLIBDEF) $(CFLAGS) $*.c                             @@\
+       $(CC) -c $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c                    @@\
                                                                        @@\
 clean::                                                                        @@\
        -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \           @@\
@@ -716,11 +716,11 @@ all::                                                                     @@\
                                                                        @@\
 .c.o:                                                                  @@\
        $(RM) $@ shared/$@ debugger/$@                                  @@\
-       $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) $*.c       @@\
+       $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c @@\
        $(MV) $*.o shared/$*.o                                          @@\
-       $(CC) -g -c $(SHLIBDEF) $(CFLAGS) $*.c                          @@\
+       $(CC) -g -c $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c                 @@\
        $(MV) $*.o debugger/$*.o                                        @@\
-       $(CC) -c $(SHLIBDEF) $(CFLAGS) $*.c                             @@\
+       $(CC) -c $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c                    @@\
                                                                        @@\
 clean::                                                                        @@\
        -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \   @@\
@@ -1195,88 +1195,61 @@ MakeLintSubdirs(dirs,lintlib,lintlib)
 #define MakeMakeSubdirs(dirs,target)                                   @@\
 target::                                                               @@\
        @case '${MFLAGS}' in *[ik]*) set +e;; esac; \                   @@\
+       case '${MFLAGS}' in *n*) executeit="no";; esac; \               @@\
        for i in dirs ;\                                                @@\
        do \                                                            @@\
-               echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \     @@\
                case "$$i" in \                                         @@\
-               ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ @@\
-               ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \          @@\
-               ./?*/?*)    newtop=../../ sub=subsub;; \                @@\
-               ./?*)       newtop=../ sub=sub;; \                      @@\
-               */?*/?*/?*)    newtop=../../../../ sub=subsubsubsub;; \ @@\
-               */?*/?*)    newtop=../../../ sub=subsubsub;; \          @@\
-               */?*)       newtop=../../ sub=subsub;; \                @@\
-               *)          newtop=../ sub=sub;; \                      @@\
+               ./?*/?*/?*/?*)  newtop=../../../..;; \                  @@\
+               ./?*/?*/?*)     newtop=../../..;; \                     @@\
+               ./?*/?*)        newtop=../..;; \                        @@\
+               ./?*)           newtop=..;; \                           @@\
+               */?*/?*/?*)     newtop=../../../..;; \                  @@\
+               */?*/?*)        newtop=../../..;; \                     @@\
+               */?*)           newtop=../..;; \                        @@\
+               *)              newtop=..;; \                           @@\
                esac; \                                                 @@\
                case "$(TOP)" in \                                      @@\
-               /?*) newtop=  upprefix=  ;; \                           @@\
-               *) upprefix=../ ;; \                                    @@\
+               /?*) imaketop=$(TOP) ; top=$(TOP) ; curdir=$(CURRENT_DIR)/;; \ @@\
+               .) imaketop=$$newtop/ ; top=$$newtop ; curdir= ;; \     @@\
+               *) imaketop=$$newtop/ ; top=$$newtop/$(TOP) ; curdir=$(CURRENT_DIR)/ ;; \       @@\
                esac; \                                                 @@\
-               $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \               @@\
-               MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ @@\
+               echo "making Makefiles in $${curdir}$$i..."; \          @@\
+               cd $$i; \                                               @@\
+               $(RM) Makefile.bak; \                                   @@\
+               if [ -f Makefile ]; then \                              @@\
+                       echo "  $(MV) Makefile Makefile.bak"; \         @@\
+                       if [ "$$executeit" != "no" ]; then \            @@\
+                               $(MV) Makefile Makefile.bak; \          @@\
+                       fi; \                                           @@\
+               fi; \                                                   @@\
+               if [ "$$executeit" != "no" ]; then \                    @@\
+                       ImakeSubCmdHelper -DTOPDIR=$$top -DCURDIR=$${curdir}$$i -f$(SRCSUBDIR)Imakefile; \ @@\
+               fi; \                                                   @@\
+               $(MAKE) $(MFLAGS) Makefiles; \                          @@\
+               cd $$newtop; \                                          @@\
        done
-#endif /* MakeMakeSubdirs */
 
+#ifdef SourceTop
+        SRCSUBDIR = SourceTop/$${curdir}$${i}/
+#endif
 
-/*
- * MakeNsubdirMakefiles - generate rules to create sub Makefiles.
- */
-#ifndef MakeNsubdirMakefiles
-#define MakeNsubdirMakefiles()                                         @@\
-subdirMakefiles:                                                       @@\
-       cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR) -s Makefile.new; \   @@\
-       $(MAKE) -f Makefile.new noop                                    @@\
-       -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \                 @@\
-       echo "  $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak; $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; $(MV) $(MAKEFILE_SUBDIR)/Makefile.new $(MAKEFILE_SUBDIR)/Makefile"; \ @@\
-       $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak; \                        @@\
-       $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
-       fi;                                                             @@\
-       $(MV) $(MAKEFILE_SUBDIR)/Makefile.new $(MAKEFILE_SUBDIR)/Makefile; \ @@\
-       cd $(MAKEFILE_SUBDIR); $(MAKE) $(MFLAGS) Makefiles;             @@\
-                                                                       @@\
-subsubdirMakefiles:                                                    @@\
-       cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR) -s Makefile.new; \   @@\
-       $(MAKE) -f Makefile.new noop                                    @@\
-       -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \                 @@\
-       echo "  $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak; $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; $(MV) $(MAKEFILE_SUBDIR)/Makefile.new $(MAKEFILE_SUBDIR)/Makefile"; \ @@\
-       $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak; \                        @@\
-       $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
-       $(MV) $(MAKEFILE_SUBDIR)/Makefile.new $(MAKEFILE_SUBDIR)/Makefile; \ @@\
-       cd $(MAKEFILE_SUBDIR); $(MAKE) $(MFLAGS) Makefiles; \           @@\
-       else exit 0; fi                                                 @@\
-                                                                       @@\
-subsubsubdirMakefiles:                                                 @@\
-       cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR) -s Makefile.new; \   @@\
-       $(MAKE) -f Makefile.new noop                                    @@\
-       -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \                 @@\
-       echo "  $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak; $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; $(MV) $(MAKEFILE_SUBDIR)/Makefile.new $(MAKEFILE_SUBDIR)/Makefile"; \ @@\
-       $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak; \                        @@\
-       $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
-       $(MV) $(MAKEFILE_SUBDIR)/Makefile.new $(MAKEFILE_SUBDIR)/Makefile; \ @@\
-       cd $(MAKEFILE_SUBDIR); $(MAKE) $(MFLAGS) Makefiles; \           @@\
-       else exit 0; fi                                                 @@\
-                                                                       @@\
-subsubsubsubdirMakefiles:                                              @@\
-       cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR) -s Makefile.new; \   @@\
-       $(MAKE) -f Makefile.new noop                                    @@\
-       -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \                 @@\
-       echo "  $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak; $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; $(MV) $(MAKEFILE_SUBDIR)/Makefile.new $(MAKEFILE_SUBDIR)/Makefile"; \ @@\
-       $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak; \                        @@\
-       $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
-       $(MV) $(MAKEFILE_SUBDIR)/Makefile.new $(MAKEFILE_SUBDIR)/Makefile; \ @@\
-       cd $(MAKEFILE_SUBDIR); $(MAKE) $(MFLAGS) Makefiles; \           @@\
-       else exit 0; fi
-#endif /* MakeNsubdirMakefiles */
+#ifdef UseImakeInstalled
+#define ImakeSubCmdHelper $(IMAKE) -I$${imaketop}$(NEWTOP)$(IRULESRC) $(IMAKE_DEFINES)
+#else
+#ifdef UseInstalled
+#define ImakeSubCmdHelper $(IMAKE_CMD)
+#else
+#define ImakeSubCmdHelper $${imaketop}$(NEWTOP)$(IMAKE) -I$${imaketop}$(NEWTOP)$(IRULESRC) $(IMAKE_DEFINES)
+#endif
+#endif
 
+#endif /* MakeMakeSubdirs */
 
 /*
  * MakefileSubdirs - generate rules to create Makefiles.
  */
 #ifndef MakefileSubdirs
-#define MakefileSubdirs(dirs)                                          @@\
-MakeMakeSubdirs(dirs,Makefiles)                                                @@\
-                                                                       @@\
-MakeNsubdirMakefiles()
+#define MakefileSubdirs(dirs)  MakeMakeSubdirs(dirs,Makefiles)
 #endif /* MakefileSubdirs */
 
 
index af105f5b35e697f9879d9587b57824f412fc66af..c4feecac6ad989fd448ba0bf443083ce689ebf5f 100644 (file)
 #define MakeDependFlags /**/  
 #endif
 
+#ifdef SourceTop
+           SRCDIR = SourceTop/CURDIR/
+            VPATH = SourceTop/CURDIR
+           SRCTOP = SourceTop
+       SRCINCLUDE = -I/**/SourceTop/CURDIR
+#endif
             SHELL = BourneShell
 
               TOP = TOPDIR
index 2189283bcedd8c61a06e0e06c4c3078ac6e44914..2364510084785a65ea7786c6309073c826a88b51 100644 (file)
@@ -107,6 +107,10 @@ basename/**/_defs.h basename/**/_pre_defs.h basename-types.h basename/**/_tables
 
 #endif
 
+#ifdef LibraryRules
+#include LibraryRules
+#endif
+
 /*
  * AdditiveLibraryTarget - generate rules to create a library from
  * several directories
@@ -185,7 +189,8 @@ includes:: hfile                                                    @@\
 newname: stockname Makefile                                            @@\
        -$(RM) newname.new                                              @@\
        -$(UNIFDEF) $(PROCESS_DEFINES) stockname >newname.new           @@\
-       CopyHeaderNewName(newname.new,.,newname)
+       if cmp -s newname.new newname ; then true; \                    @@\
+       else $(RM) newname ; $(CP) newname.new newname ; fi
 #endif /* ProcessStockHeader */
 
 /*
@@ -310,20 +315,13 @@ clean::                                                                   @@\
  */
 #ifndef SimpleTestProgramTarget
 #define        SimpleTestProgramTarget(program)                                @@\
-           OBJS = program.o                                            @@\
-           SRCS = program.c                                            @@\
-        PROGRAM = program                                              @@\
-                                                                       @@\
 AllTarget(program)                                                     @@\
                                                                        @@\
-program: $(OBJS) $(DEPLIBS)                                            @@\
+program: program.o $(DEPLIBS)                                          @@\
        RemoveTargetProgram($@)                                         @@\
-       $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) @@\
+       $(CC) -o $@ program.o $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) @@\
                                                                        @@\
-SaberProgramTarget(program,$(SRCS),$(OBJS),$(LOCAL_LIBRARIES), /**/)   @@\
-                                                                       @@\
-DependTarget()                                                         @@\
-LintTarget()                                                           @@\
+SaberProgramTarget(program,program.c,program.o,$(LOCAL_LIBRARIES), /**/)@@\
                                                                        @@\
 clean::                                                                        @@\
        $(RM) $(PROGRAM)
@@ -441,7 +439,11 @@ P_VOLATILE=-UUseVolatile
  */
 
             ARADD = ArAddCmd
+#ifdef SourceTop
+     TOP_INCLUDES = -I$(TOP)/include -I/**/SourceTop/include $(STDC_TOP_INCLUDES)
+#else
      TOP_INCLUDES = -I$(TOP)/include $(STDC_TOP_INCLUDES)
+#endif
         CONFIGSRC = $(TOP)/config
             ISODE = IsodeDir
          PSYFLAGS = PepsyFlags
index fe95a2ab5eaea8998cd8fdce70a7e5429eb49064..92da9d5fa56d39bf874a68f524fbc34684886c4e 100644 (file)
@@ -32,19 +32,19 @@ K4LIB=
 #endif
 DEFINES = -DBACKWARD_COMPAT $(KRB4DEF)
 
-INCLUDES = $(KRB4INCLUDES)
+INCLUDES = $(KRB4INCLUDES) -I.
 SRCS= \
        kdc5_err.c \
-       dispatch.c \
-       do_as_req.c \
-       do_tgs_req.c \
-       kdc_util.c \
-       main.c \
-       network.c \
-       policy.c \
-       extern.c \
-       replay.c \
-       kerberos_v4.c
+       $(SRCDIR)dispatch.c \
+       $(SRCDIR)do_as_req.c \
+       $(SRCDIR)do_tgs_req.c \
+       $(SRCDIR)kdc_util.c \
+       $(SRCDIR)main.c \
+       $(SRCDIR)network.c \
+       $(SRCDIR)policy.c \
+       $(SRCDIR)extern.c \
+       $(SRCDIR)replay.c \
+       $(SRCDIR)kerberos_v4.c
 
 OBJS= \
        kdc5_err.o \
index 40e3ffce33c46d9f3f13c73e58c5201acff95633..4cf8199ff4206d10617b1e36c6c3f632af694b00 100644 (file)
@@ -53,3 +53,6 @@ DependTarget()
 
 Krb5InstallHeaders($(ETHDRS), $(KRB5_INCDIR)/krb5)
 
+SpecialObjectRule(isode_err.o,isode_err.c,)
+SpecialObjectRule(krb5_err.o,krb5_err.c,)
+SpecialObjectRule(kdb5_err.o,kdb5_err.c,)