[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / mkworld / macros-ghc.ljm
1 %************************************************************************
2 %*                                                                      *
3 \section[mkworld-macros-ghc]{CPP macros for @ghc@ project}
4 %*                                                                      *
5 %************************************************************************
6
7 Rule to run the LML-ish \tr{ugen} utility.
8 \begin{code}
9 /* ToDo: cmp -> $(CMP) */
10
11 #ifndef UgenTarget
12 #define UgenTarget(fileroot)                                            @@\
13 ExtraStuffToBeVeryClean(fileroot.c fileroot.h fileroot.hs)              @@\
14 fileroot.c : fileroot.ugn                                               @@\
15         d=`dirname fileroot.ugn` ; f=`basename fileroot.ugn .ugn` ; \   @@\
16         $(RM) fileroot.c fileroot.hs "$$d/U_$$f.hs" fileroot.h-SAVE     @@\
17         if [ -f fileroot.h ] ; then $(MV) -f fileroot.h fileroot.h-SAVE ; else exit 0 ; fi @@\
18         $(UGEN) fileroot.ugn || ( $(RM) fileroot.h fileroot.c fileroot.hs; $(MV) -f fileroot.h-SAVE fileroot.h )                                                @@\
19         if cmp -s fileroot.h-SAVE fileroot.h ; then \                   @@\
20             $(MV) -f fileroot.h-SAVE fileroot.h ; \                     @@\
21         else \                                                          @@\
22             chmod 444 fileroot.h fileroot.c fileroot.hs ; \             @@\
23         fi                                                              @@\
24         @$(RM) fileroot.h-SAVE                                          @@\
25         @d=`dirname fileroot.ugn` ; f=`basename fileroot.ugn .ugn` ; \  @@\
26         $(MV) -f fileroot.hs "$$d/U_$$f.hs"                             @@\
27                                                                         @@\
28 fileroot.h : fileroot.c                                                 @@\
29         @: /* no-op */
30 #endif /* UgenTarget */
31 \end{code}