Fixed lots of warning and made code compatible with C89 and ANSI with -pedantic.
[pforth] / build / unix / Makefile
index a7dbb5d..162cf5b 100644 (file)
@@ -4,7 +4,7 @@
 # For more info visit http://www.softsynth.com/pforth/
 #
 # See "help" target below.
 # For more info visit http://www.softsynth.com/pforth/
 #
 # See "help" target below.
-\r
+
 .SUFFIXES: .c .o
 
 # Options include: PF_SUPPORT_FP PF_NO_MALLOC PF_NO_INIT PF_DEBUG
 .SUFFIXES: .c .o
 
 # Options include: PF_SUPPORT_FP PF_NO_MALLOC PF_NO_INIT PF_DEBUG
@@ -24,21 +24,23 @@ OBJECTDIR    = $(PFORTHDIR)/objects
 TEMPOBJECTDIR = $(PFORTHDIR)/tempobjects
 
 # This is needed to get pForth to build on Snow Leopard and other 64 bit platforms.
 TEMPOBJECTDIR = $(PFORTHDIR)/tempobjects
 
 # This is needed to get pForth to build on Snow Leopard and other 64 bit platforms.
-WIDTHOPT=-m32
+WIDTHOPT=
 
 FULL_WARNINGS =  \
 
 FULL_WARNINGS =  \
+        -c89 \
         -fsigned-char \
         -fno-builtin \
         -fno-unroll-loops \
         -fpeephole \
         -fno-keep-inline-functions \
         -fsigned-char \
         -fno-builtin \
         -fno-unroll-loops \
         -fpeephole \
         -fno-keep-inline-functions \
+        -pedantic \
         -Wcast-qual \
         -Wall \
         -Wwrite-strings \
         -Winline  \
         -Wmissing-prototypes \
         -Wmissing-declarations
         -Wcast-qual \
         -Wall \
         -Wwrite-strings \
         -Winline  \
         -Wmissing-prototypes \
         -Wmissing-declarations
-        
+
 DEBUGOPTS = -g
 CCOPTS = $(WIDTHOPT) -x c -DPF_SUPPORT_FP -O2 $(FULL_WARNINGS) $(EXTRA_CCOPTS) $(DEBUGOPTS)
 
 DEBUGOPTS = -g
 CCOPTS = $(WIDTHOPT) -x c -DPF_SUPPORT_FP -O2 $(FULL_WARNINGS) $(EXTRA_CCOPTS) $(DEBUGOPTS)
 
@@ -57,11 +59,11 @@ PFOBJS     = ${PFTEMP:${CSRCDIR}/%=${TEMPOBJECTDIR}/%}
 PFEMBOBJS  = ${PFTEMP:${CSRCDIR}/%=${OBJECTDIR}/%}
 
 COMPILE = $(COMPILER) $(CCOPTS) $(CDEFS)
 PFEMBOBJS  = ${PFTEMP:${CSRCDIR}/%=${OBJECTDIR}/%}
 
 COMPILE = $(COMPILER) $(CCOPTS) $(CDEFS)
-       
+
 ${TEMPOBJECTDIR}/%.o:  ${TEMPOBJECTDIR} $(PFINCLUDES)  ${CSRCDIR}/%.c
        $(COMPILE) -O -o ${TEMPOBJECTDIR}/$*.o -c ${CSRCDIR}/$*.c
 ${TEMPOBJECTDIR}/%.o:  ${TEMPOBJECTDIR} $(PFINCLUDES)  ${CSRCDIR}/%.c
        $(COMPILE) -O -o ${TEMPOBJECTDIR}/$*.o -c ${CSRCDIR}/$*.c
-       
-${OBJECTDIR}/%.o:  ${OBJECTDIR} $(PFINCLUDES) ${CSRCDIR}/%.c ${CSRCDIR}/pfdicdat.h 
+
+${OBJECTDIR}/%.o:  ${OBJECTDIR} $(PFINCLUDES) ${CSRCDIR}/%.c ${CSRCDIR}/pfdicdat.h
        $(COMPILE) -O -o ${OBJECTDIR}/$*.o -c ${CSRCDIR}/$*.c $(EMBCCOPTS)
 
 all: $(PFORTHAPP)
        $(COMPILE) -O -o ${OBJECTDIR}/$*.o -c ${CSRCDIR}/$*.c $(EMBCCOPTS)
 
 all: $(PFORTHAPP)
@@ -77,12 +79,12 @@ pffiles:
        @echo ${PFOBJS}
        @echo "EMBEDDED OBJECT FILES ------------------"
        @echo ${PFEMBOBJS}
        @echo ${PFOBJS}
        @echo "EMBEDDED OBJECT FILES ------------------"
        @echo ${PFEMBOBJS}
-       
-${TEMPOBJECTDIR}: 
+
+${TEMPOBJECTDIR}:
        mkdir -p ${TEMPOBJECTDIR}/posix
        mkdir -p ${TEMPOBJECTDIR}/stdio
 
        mkdir -p ${TEMPOBJECTDIR}/posix
        mkdir -p ${TEMPOBJECTDIR}/stdio
 
-${OBJECTDIR}: 
+${OBJECTDIR}:
        mkdir -p ${OBJECTDIR}/posix
        mkdir -p ${OBJECTDIR}/stdio
 
        mkdir -p ${OBJECTDIR}/posix
        mkdir -p ${OBJECTDIR}/stdio
 
@@ -98,8 +100,8 @@ $(PFORTHAPP): $(PFDICDAT) $(PFEMBOBJS)
        $(COMPILER) $(PFEMBOBJS) $(WIDTHOPT) -lm -o $(PFORTHAPP)
        @echo ""
        @echo "Standalone pForth executable written to $(PFORTHAPP)"
        $(COMPILER) $(PFEMBOBJS) $(WIDTHOPT) -lm -o $(PFORTHAPP)
        @echo ""
        @echo "Standalone pForth executable written to $(PFORTHAPP)"
-       
-       
+
+
 # target aliases
 pfdicapp: $(PFDICAPP)
 
 # target aliases
 pfdicapp: $(PFDICAPP)
 
@@ -117,10 +119,18 @@ help:
        @echo "   The file 'fth/pfdicdat.h' is generated by pForth. It contains a binary image of the Forth dictionary."
        @echo "   It allows pForth to work as a standalone image that does not need to load a dictionary file."
 
        @echo "   The file 'fth/pfdicdat.h' is generated by pForth. It contains a binary image of the Forth dictionary."
        @echo "   It allows pForth to work as a standalone image that does not need to load a dictionary file."
 
+test: $(PFORTHAPP)
+       cd $(FTHDIR); ../pforth_standalone -q t_corex.fth
+       cd $(FTHDIR); ../pforth_standalone -q t_strings.fth
+       cd $(FTHDIR); ../pforth_standalone -q t_locals.fth
+       cd $(FTHDIR); ../pforth_standalone -q t_alloc.fth
+       cd $(FTHDIR); ../pforth_standalone -q t_floats.fth
 
 clean:
 
 clean:
-       -rm -f $(PFOBJS) $(PFEMBOBJS)
-       -rm $(PFORTHAPP)
-       -rm $(PFDICDAT)
-       -rm $(PFORTHDIC)
-       -rm $(PFDICAPP)
+       rm -f $(PFOBJS) $(PFEMBOBJS)
+       rm -f $(PFORTHAPP)
+       rm -f $(PFDICDAT)
+       rm -f $(PFORTHDIC)
+       rm -f $(PFDICAPP)
+       rm -rf $(OBJECTDIR) $(TEMPOBJECTDIR)
+