bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gawk] Suggestion on pc/Makefile


From: Vincent Belaïche
Subject: [bug-gawk] Suggestion on pc/Makefile
Date: Wed, 26 Oct 2016 15:42:30 +0200

Hello,

Attached is a patch to pc/Makefile that allows to build without prior
copying of source files to the pc/ directory.

I found also that in the orignal Makefile the 'pc/gawkmisc.pc' had to be
replaced by 'gawkmisc.pc'.

I also found that the awkgram.c is missing from the clean target.

Based on some independent testing, it also seems that whether you tell
gcc '-I.. -I.' or '-I. -I..' does not change anything, '.' always has
higher precedence on '..'.

Not sure whether you like it, it might be too GNU-make dependent.

VBR,
        Vincent.




---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel 
antivirus Avast.
https://www.avast.com/antivirus
diff --git a/pc/Makefile b/pc/Makefile
index 7bf8a7e..72c6a4d 100644
--- a/pc/Makefile
+++ b/pc/Makefile
@@ -91,6 +91,8 @@ install = 1
 # that $($X) can be expanded.
 DO_LNK = $($(LNK))
 DO_BIND= $($(BIND))
+#------------------------------------------------------------------------
+SRCDIR:=..
 #========================================================================
 # End of general configuration. Some platform-specific configuration
 # notes appear below.
@@ -198,7 +200,7 @@ BIND = EMPTY
 PBIND = EMPTY
 EMPTY=
 
-CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H -DDEFLIBPATH=$(DEFLIBPATH) 
-DSHLIBEXT=$(SHLIBEXT)
+CFLAGS = $(CF) -DGAWK -I. -I.. -DHAVE_CONFIG_H -DDEFLIBPATH=$(DEFLIBPATH) 
-DSHLIBEXT=$(SHLIBEXT)
 
 # object files
 AWKOBJS1  = array$O builtin$O eval$O field$O floatcomp$O gawkmisc$O io$O main$O
@@ -219,7 +221,7 @@ GAWKOBJS = $(ALLOBJS) $(LIBOBJS)
 # .SUFFIXES:
 .SUFFIXES: .c $O
 
-.c$O:
+%$O: ../%.c
        $(CC) -c $(CFLAGS) $<
 
 # rules to build gawk
@@ -242,36 +244,36 @@ $(RSPFILE) : $(GAWKOBJS)
 #    included by awk.h.
 # 2. custom.h is not mentioned because pc ports don't use it.
 $(ALLOBJS) $(LIBOBJS): \
-  awk.h regex.h config.h gettext.h mbsupport.h protos.h dfa.h getopt.h 
nonposix.h
+  $(addprefix $(SRCDIR)/,awk.h regex.h gettext.h mbsupport.h protos.h dfa.h 
getopt.h nonposix.h) config.h
 
-builtin$O:     floatmagic.h random.h popen.h
+builtin$O:     $(addprefix $(SRCDIR)/,floatmagic.h random.h) popen.h
 
-random$O:      random.h
+random$O:      $(SRCDIR)/random.h
 
-node$O:                floatmagic.h
+node$O:                $(SRCDIR)/floatmagic.h
 
-command$O debug$O:     cmd.h
+command$O debug$O:     $(SRCDIR)/cmd.h
 
-dfa$O:         xalloc.h
+dfa$O:         $(SRCDIR)/xalloc.h
 
-gawkmisc$O:    pc/gawkmisc.pc socket.h
+gawkmisc$O:    gawkmisc.pc socket.h
 
-getopt$O getopt1$O :   getopt_int.h
+getopt$O getopt1$O :   $(SRCDIR)/getopt_int.h
 
 io$O:          popen.h socket.h in.h
 
-regex$O:       regcomp.c regexec.c regex_internal.h
+regex$O:       $(addprefix $(SRCDIR)/,regcomp.c regexec.c regex_internal.h)
 
-eval$O:                interpret.h
+eval$O:                $(SRCDIR)/interpret.h
 
 # A bug in ndmake requires the following rule
-awkgram$O: awk.h awkgram.c
-       $(CC) -c $(CFLAGS) awkgram.c
+awkgram$O: awkgram.c $(SRCDIR)/awk.h
+       $(CC) -c $(CFLAGS) $<
 
-awkgram.c:     awkgram.y
-       bison -o $@ awkgram.y
+awkgram.c:     $(SRCDIR)/awkgram.y
+       bison -o $@ $<
 
-alloca$O:      alloca.c
+alloca$O:      $(SRCDIR)/alloca.c
 
 popen$O:       popen.h
 
@@ -303,7 +305,8 @@ install-strip: install$(install)
        -$(MAKE) -C extension $@
 
 clean:
-       -rm -rf gawk *.exe gawk.map *.o *.obj core a.out $(RSPFILE) $(PRSPFILE) 
$(DRSPFILE) $(DYN_EXP)
+       -rm -rf gawk *.exe gawk.map *.o *.obj core a.out $(RSPFILE) $(PRSPFILE) 
$(DRSPFILE) \
+               $(DYN_EXP) awkgram.c
 #      cd doc && $(MAKE) clean
 #      cd test && $(MAKE) clean
 #      cd awklib && $(MAKE) clean

reply via email to

[Prev in Thread] Current Thread [Next in Thread]