Operating System - HP-UX
1752620 Members
4359 Online
108788 Solutions
New Discussion юеВ

Re: Separator on Rules error when compiling

 
SOLVED
Go to solution
Coolmar
Esteemed Contributor

Separator on Rules error when compiling

Hi,

I am trying to compile a program and get the following error:

Make: Must be a separator on rules line 42. Stop.

Here is the Makefile:


CC = gcc

LIB_OBJS = intxfile.o ntx.o ntxrecs.o ntxshape.o ntxdesc.o ntxline.o \
descattr.o dbfout.o dbfopen.o shpopen.o shpout.o \
lineout.o pntout.o nameout.o patmatch.o \
ntxbuild.o ntxsearch.o polyout.o

EXE_OBJS = ntxshape.ro stripext.o convert.o

DLL_OBJS = avntxshp.ro ntxshp.o avexec.o dllmain.o statusdlg.o

ALL_TARGETS = libntxshape.a ntxshape.exe ntxapi14.dll


.PHONY: all clean clean_objects clean_targets
.IGNORE: clean_objects clean_targets
.SILENT: clean_objects clean_targets

CFLAGS = -mcpu=pentiumpro -malign-double -Wall

ifdef DEBUG
CPPFLAGS = -DDEBUG
CFLAGS = -g
else
CFLAGS = -O3 -funroll-loops -ffast-math
LDFLAGS = -Wl,--strip-all
endif


ifdef PROFILE
CFLAGS = -pg
LDFLAGS = -pg
endif

CXXFLAGS = $(CFLAGS)

%.o : %.cpp
g++ -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@

%.ro: %.rc
rc /i "%MSSdk%\include" $<
windres -O coff $*.res $@
rm $*.res

%.tlb: %.idl
echo Generating typelib. This may fail if CL.EXE is not found...
midl /win32 /I "%MSSdk%\include" $<

#Someone please show me how to use the /cpp_cmd and /cpp_opt
#flags to invoke cpp.exe as the preprocessor for midl.

all: $(ALL_TARGETS)

libntxshape.a: $(LIB_OBJS)
ar -rs libntxshape.a $^

ntxshape.exe: $(EXE_OBJS) libntxshape.a
g++ $(LDFLAGS) -o $@ $^

ntxapi14.dll: $(DLL_OBJS) libntxshape.a
g++ --shared $(LDFLAGS) -Wl,--add-stdcall-alias -Wl,--enable-auto-image-base -mthreads --mwindows -o $@ $^ -ladvapi32 -lcomctl32


clean: clean_objects clean_targets

clean_objects:
echo Removing intermediate files
rm $(EXE_OBJS) $(DLL_OBJS) $(LIB_OBJS)

clean_targets:
echo Removing target files
rm $(ALL_TARGETS)

include dependencies
avntxshp.ro: ntxapi.tlb


Line 42 is the CPPFLAGS = -DDEBUG

Any ideas?

12 REPLIES 12
Ermin Borovac
Honored Contributor
Solution

Re: Separator on Rules error when compiling

This looks like a Makefile that was written for GNU make. HP's make does not understand some of the constructs used in this Makefile (e.g. %.cpp etc).

You can get GNU make from HP-UX software porting archive.
Coolmar
Esteemed Contributor

Re: Separator on Rules error when compiling

I tried gmake and got the following:

gmake: *** No rule to make target `dependencies'. Stop.
Ermin Borovac
Honored Contributor

Re: Separator on Rules error when compiling

Your makefile includes another makefile called 'dependencies'. Does that file exist?
A. Clay Stephenson
Acclaimed Contributor

Re: Separator on Rules error when compiling

If memory serves me, in gmake you can change
"include myfile" to "-include myfile" and now
the make will not fail if "myfile" is not found. I would try putting a "-" in front of "include" or better still, find the file "dependencies".

The other thing to really look for is the placement of . Make is one of the very few UNIX utilities where just any old whitespace will not work equally well.


For example, make sure that
libntxshape.a: $(LIB_OBJS)
ar -rs libntxshape.a $^

is actually this:

libntxshape.a: $(LIB_OBJS)
ar -rs libntxshape.a $^




If it ain't broke, I can fix that.
Amit Agarwal_1
Trusted Contributor

Re: Separator on Rules error when compiling

Ypu get the "separator error" if the command line doens't start with tab.

1. Open the file
2. goto line 42
3. Insert a tab at the first column.

Generally copy-paste would replace with s.

The makefile rule on HP-UX must resemble this

:


The above line should start with a tab.
Vibhor Kumar Agarwal
Esteemed Contributor

Re: Separator on Rules error when compiling

Have you copied this file from some windows platform.

I often get this type of error after copying the file from windows background.

Do
dos2ux makefile > newfile; mv newfile makefile
Vibhor Kumar Agarwal
Coolmar
Esteemed Contributor

Re: Separator on Rules error when compiling

There is a file called makedependencies.sh - I have pasted it below. I guess I should run it.

This package is a real pain....unix, but saved in a windows zip format....no README or anything detailing how you are to compile it.

more makedependencies.sh
# * The contents of this file are subject to the Mozilla Public License
# * Version 1.1 (the "License"); you may not use this file except in
# * compliance with the License. You may obtain a copy of the License at
# * http://www.mozilla.org/MPL/
# *
# * Software distributed under the License is distributed on an "AS IS"
# * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# * the License for the specific language governing rights and limitations
# * under the License.
# *
# * The Original Code is NTXShape - NTX to Shapefile Converter.
# *
# * The Initial Developer of the Original Code is ESRI Canada Limited.
# * Portions created by ESRI Canada are Copyright (C) 1997-2003
# * ESRI Canada Limited. All Rights Reserved.
# *
# * Contributor(s):
# * Bruce Dodson

gcc -MM *.cpp *.c > dependencies
gcc -MM -xc++ *.rc | sed -e "s/\.rc\.o/.ro/" >> dependencies
gcc -MM -xc++ *.idl | sed -e "s/\.idl\.o/.tlb/" >> dependencies
Coolmar
Esteemed Contributor

Re: Separator on Rules error when compiling

Well I ran the makedependencies.sh and got the following:

sh makedependencies.sh
/usr/lib/dld.sl: Unresolved symbol: libintl_bindtextdomain (code) from gcc
makedependencies.sh[20]: 3021 Abort(coredump)
/usr/lib/dld.sl: Unresolved symbol: libintl_bindtextdomain (code) from gcc
makedependencies.sh[21]: 3022 Abort(coredump)
/usr/lib/dld.sl: Unresolved symbol: libintl_bindtextdomain (code) from gcc
makedependencies.sh[22]: 3024 Abort(coredump)
Ermin Borovac
Honored Contributor

Re: Separator on Rules error when compiling

Your gcc binary was linked with libintl.sl library, but it looks like this library cannot be found (missing symbol is in libintl.sl). Check your gcc binary with chatr to see which directory it is expecting it to be in.

# chatr /usr/local/bin/gcc

If you downloaded gcc from HP-UX porting archive, make sure that you also have libiconv and gettext (gcc's run-time dependencies).

Alternative is to get working gcc from http://www.hp.com/go/gcc or http://www.cmve.net/~merijn/downloads.html.