#define concat(x,y) x##y
#define concat3(x,y,z) x##y##z
#define concat4(w,x,y,z) w##x##y##z
+#define concat5(v,w,x,y,z) v##w##x##y##z
#define requote(x) #x
#else
#define concat(x,y)x/**/y
#define concat3(x,y,z)x/**/y/**/z
#define concat4(w,x,y,z)w/**/x/**/y/**/z
+#define concat5(v,w,x,y,z)v/**/w/**/x/**/y/**/z
#define requote(x) "x"
#endif
all:: pgm @@\
@@\
pgm: objs localdeps @@\
- $(CC) $(CFLAGS) -o $@ objs localdeps syslibs @@\
+ $(CC) $(CFLAGS) -o $@ objs syslibs @@\
@@\
clean:: @@\
$(RM) pgm objs @@\
@@\
depend:: concat(src,.h)
+#define mk_cmds(tbl) @@\
+concat(tbl,.o): concat(tbl,.ct) @@\
+ $(MAKE_COMMANDS) concat(tbl,.ct) @@\
+clean:: @@\
+ $(RM) concat(src,.o)
+
/*
* Rule for building some random object module
*/
clean:: @@\
$(RM) pgm objs @@\
+/*
+ * Special rule for building and installing a Berkeley r-command
+ * We need to preserve the original copies upon installation.
+ */
+
+#define ucbprogram(pgm,objs,localdeps,syslibs,installdir) @@\
+all:: pgm @@\
+ @@\
+pgm: objs localdeps @@\
+ $(CC) $(CFLAGS) -o $@ objs syslibs @@\
+ @@\
+install:: @@\
+ if [ ! -f concat5(${DESTDIR},installdir,/,pgm,.ucb) -a -f concat4(${DESTDIR},installdir,/,pgm) ]; then \ @@\
+ mv concat4(${DESTDIR},installdir,/,pgm) concat5(${DESTDIR},installdir,/,pgm,.ucb); fi; exit 0 @@\
+ $(INSTALLSUID) pgm concat4(${DESTDIR},installdir,/,pgm) @@\
+ @@\
+clean:: @@\
+ $(RM) pgm objs @@\
+
+
/*
* Rule for installing man pages. Section installing into should match
* suffix, or the man page won't show up when using man(1).
#define manpage(section,page) @@\
all:: @@\
install:: page @@\
- $(INSTALLFILE) page concat3(${DESTDIR}${MANDIR}/man,section,/`basename page`) @@\
+ $(INSTALLFILE) page concat4(${DESTDIR}${MANDIR}/man,section,/,`basename page`) @@\
/*
* Rule for building makefile dependencies.
src:: ${CODE} @@\
@@\
${CODE}: @@\
+ $(RM) $@ @@\
-$(LN) ${SRCDIR}/$@ $@
#define do_subdirs_no_imakefile(subdirs) @@\