I'm trying to install the following GitHub Repository in my machine:
Br-Altlas
The instructions tell me to install Gdal before clonning it, and then run npm install and run the command "make".
When I run the make command in the Git Bash, I have the following response:
mkdir -p geo/
ogr2ogr -f GeoJSON geo/ac-municipalities.json tmp/ac-municipalities/map.shp
process_begin: CreateProcess(NULL, ogr2ogr -f GeoJSON geo/ac-municipalities.json tmp/ac-municipalities/map.shp, ...) failed.
make (e=2):The system cannot find the specified file.
make: *** [Makefile:70: geo/ac-municipalities.json] Error 2
And when I run the same command in the Windows Power Shell, my answer is this:
mkdir -p zip/
Command syntax is incorrect.
make: *** [Makefile:48: zip/ac-municipalities.zip] Error 1
I found some simmilar issues, but couldn't find a solution that solves it for me.
The content of the MakerFile is this:
# -- Configurations
# TopoJSON configurations
TOPOJSON = node --max_old_space_size=8192 node_modules/.bin/topojson -q 1e6
# All Brazilian states
STATES = \
ac al am ap ba ce df es go ma \
mg ms mt pa pb pe pi pr rj rn \
ro rr rs sc se sp to
all: \
node_modules \
$(addprefix topo/,$(addsuffix -municipalities.json,$(STATES))) \
$(addprefix topo/,$(addsuffix -micro.json,$(STATES))) \
$(addprefix topo/,$(addsuffix -meso.json,$(STATES))) \
$(addprefix topo/,$(addsuffix -state.json,$(STATES))) \
permission
# Install dependencies
node_modules:
npm install
# Add execute permission
permission:
chmod +x scripts/merge.py
# .SECONDARY with no dependencies marks all file targets mentioned in the makefile as secondary.
.SECONDARY:
# -- Downloading and extracting IBGE files
# Downloads the zip files
# ftp://geoftp.ibge.gov.br/malhas_digitais/municipio_2010/
zip/%.zip:
$(eval STATE := $(patsubst %-municipalities,%,$*))
$(eval STATE := $(patsubst %-micro,%,$(STATE)))
$(eval STATE := $(patsubst %-meso,%,$(STATE)))
$(eval STATE := $(patsubst %-state,%,$(STATE)))
$(eval FILENAME := $(subst -municipalities,_municipios,$*))
$(eval FILENAME := $(subst -micro,_microrregioes,$(FILENAME)))
$(eval FILENAME := $(subst -meso,_mesorregioes,$(FILENAME)))
$(eval FILENAME := $(subst -state,_unidades_da_federacao,$(FILENAME)))
mkdir -p $(dir $#)
curl 'ftp://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2010/$(STATE)/$(FILENAME).zip' -o $#.download
mv $#.download $#
# Extracts the files
tmp/%/: zip/%.zip
rm -rf $(basename $#)
mkdir -p $(dir $#)
unzip -d tmp/$* $<
$(eval REGION := $(patsubst %-municipalities,municipalities,$*))
$(eval REGION := $(patsubst %-micro,micro,$*))
$(eval REGION := $(patsubst %-meso,meso,$*))
$(eval REGION := $(patsubst %-state,state,$*))
mv $#/*.shp $#/map.shp
mv $#/*.shx $#/map.shx
mv $#/*.dbf $#/map.dbf
mv $#/*.prj $#/map.prj
# -- Generate GeoJSON files
geo/%.json: tmp/%/
mkdir -p $(dir $#)
ogr2ogr -f GeoJSON $# tmp/$*/map.shp
iconv -f ISO-8859-1 -t UTF-8 $# > $#.utf8
mv $#.utf8 $#
touch $#
# -- Generating TopoJSON files for each state
# For individual states, municipality level
topo/%-municipalities.json: geo/%-municipalities.json
mkdir -p $(dir $#)
$(TOPOJSON) --id-property=CD_GEOCODM -p name=NM_MUNICIP -o $# municipalities=$^
touch $#
# For individual states, micro-region level
topo/%-micro.json: geo/%-micro.json
mkdir -p $(dir $#)
$(TOPOJSON) --id-property=NM_MICRO -p name=NM_MICRO -o $# micro=$^
touch $#
# For individual states, meso-region level
topo/%-meso.json: geo/%-meso.json
mkdir -p $(dir $#)
$(TOPOJSON) --id-property=NM_MESO -p name=NM_MESO -o $# meso=$^
touch $#
# For individual states, state level:
topo/%-state.json: geo/%-state.json
mkdir -p $(dir $#)
$(TOPOJSON) --id-property=CD_GEOCODU -p name=NM_ESTADO -p region=NM_REGIAO -o $# state=$^
touch $#
# -- Generating TopoJSON files for Brazil
# For Brazil with municipalities
topo/br-municipalities.json: $(addprefix geo/,$(addsuffix -municipalities.json,$(STATES)))
mkdir -p $(dir $#)
$(TOPOJSON) --id-property=CD_GEOCODM -p name=NM_MUNICIP -o $# -- $^
./scripts/merge.py $# > $#.merged
mv $#.merged $#
# For Brasil with states
topo/br-states.json: $(addprefix geo/,$(addsuffix -state.json,$(STATES)))
mkdir -p $(dir $#)
$(TOPOJSON) --id-property=CD_GEOCODU -p name=NM_ESTADO -p region=NM_REGIAO -o $# -- $^
./scripts/merge.py $# > $#.merged
mv $#.merged $#
# Simplified version of state file
topo/br-states.min.json: topo/br-states.json
$(TOPOJSON) -p --simplify-proportion=.2 -o $# -- $^
# -- Clean
# Clean temporary files
clean-tmp:
rm -rf tmp
# Clean extra files
clean-extra:
rm -rf zip
rm -rf tmp
# Clean result files
clean-result:
rm -rf shp
rm -rf geo
rm -rf topo
# Clean everything
clean: clean-tmp clean-result clean-extra
Related
The original makefile I have, which works, only involves one source folder and the makefile is stored inside this folder. Now I have multiple folders inside my src folder.
I am using an autogeneration script to work out dependencies and objective files. Each subfolder has a Make-deps and Make-objs file. These are generated from the $(AUTOGEN) command
Before I had this:
deps:
$(AUTOGEN) -d -s $(SRCDIR) -f ../scripts/fgenrc ;\
sed -i "" -e's/(SRCDIR)/(OBJDIR)/' Make-objs ; \
sed -i "" -e's/(SRCDIR)\(.*\)\.o/(OBJDIR)\1\.o/g' Make-deps ; \
So $(AUTOGEN) is just the shell script which makes the dependencies and $(SRCDIR) is where the source files are. Make-obj and Make-deps are the files containing the dependencies and objective file names.
Somewhere else I have the following:
$(OBJDIR)/%.o: %.f Makefile
#$(F90) $(FFLAGS) $(POPTIONS) -o $# $<
Now I want to this but where my %.f files are in various folders, and also where I have several Make-obj and Make-deps.
Maybe I should show an example of Make-obs and Make-deps:
Make-deps:
$(OBJDIR)/fluxes.o fluxes.o: \
path/to/src/folder1/fluxes.f90 \
$(OBJDIR)/mod.o \
$(OBJDIR)/ig.o ig.o: \
path/to/src/folder1/ig.f90 \
$(OBJDIR)/mod.o \
from the sed command I change the objective file path to be $(OBJDIR) because this is where I move them when being compiled.
Make-obj
OBJS = \
$(OBJDIR)/fluxes.o \
$(OBJDIR)/ig.o \
Now I have defined
SOURCE_FILES_c := $(shell find $(SRCDIR) -name '*.c')
SOURCE_FILES_f90 := $(shell find $(SRCDIR) -name '*.f90')
which are all source files found the SRCDIR and its subfolders. Also I have defined
DEPS_FILES := $(shell find $(SRCDIR) -name 'Makefile-deps')
OBJS_FILES := $(shell find $(SRCDIR) -name 'Makefile-objs')
which are all dependency and objective files. These are found in each subfolder containing some source code.
Then, I am trying to do following. (The target deps seems to work as when I comment out the compilation rule it does create the deps and objs file correctly in each folder.)
code: create_dir deps scripts
#make -j $(CORES) $(NAMEEXE)
$(NAMEEXE): $(LIBRARY) $(OBJS)
#$(F90) $(FFLAGS) $(OPTIONS) -o $(OBJDIR)/$(MAIN).o main/$(MAIN).f90
#$(F90) -o $(NAMEEXE) $(LOPTIONS) $(OBJS) $(LIBRARY) && \
deps:
${AUTOGEN} -d $(AUTOGEN_COMMAND) -f ${AUTOCONF} ; \
$(SEDI) -e "s/[(][^)]*[)]/\$$(OBJDIR)/g" $(OBJS_FILES) ; \
$(SEDI) -e "s/[(][^)]*[)]\(.*\)\.o/\$$(OBJDIR)\1\.o/g"
$(DEPS_FILES) ; \
$(OBJDIR)/%.o: $(SOURCE_FILES_f:.f90=.o) Makefile
#$(F90) $(FFLAGS) $(POPTIONS) -o $# $< && \
( mv -f *.mod $(OBJDIR) > /dev/null 2>&1;
$(OBJDIR)/%.o: $(SOURCE_FILES_c:.c=.o) Makefile
#$(F90) $(FFLAGS) $(POPTIONS) -o $# $< && \
( mv -f *.mod $(OBJDIR) > /dev/null 2>&1;
%.o: $(SOURCE_FILES_c:.c=.o) Makefile
#make $(OBJDIR)/$#
%.o: $(SOURCE_FILES_c:.c=.f90) Makefile
#make $(OBJDIR)/$#
I am including the deps and objs by this command
-include $(DEPS_FILES)
-include $(OBJS_FILES)
I obviously did not want put the entire makefile here, but if something is missing before you can understand what's going on please let me know.
When I type make the error I get is that my $(main) source file cannot open the compiled module file which is included in the main source.
This is because it is not compiled, but this also means that my dependency file is not working as intended?
When I look into my corresponding dep file which includes the main file, I can see that the dependency modules are added to the source file
I need to run C project written in Linux on Windows. The project contains the following: main.c, makefile, (.c) and (.h) files under folder (libs), and it includes "GL/glut.h" (openGL).
I have tried run it under Visual Studio, but didn't work out. Now, I am working with NetBeans under MinGW compiler. I did all steps mentioned to make NetBeans use MinGW compiler, but still the makefile doesn't compile, and I can't understand the error behind.
Any help is very appreciated. Thank you.
Find below the makefile:
EXECUTABLE = main
CC = g++
CWD=$(shell pwd)
INCLUDES =
CFLAGS= -O3 -funroll-loops -fomit-frame-pointer #-static -Wall
LIBFLAGS = -L./ -lGL -lGLU -lglut #-L/usr/X11R6/lib # -lXxf86vm
SOURCE_FILES = $(shell find -name \*.c)
INTERM_DIR=obj
all: $(EXECUTABLE)
clean:
$(RM) -rf $(INTERM_DIR) $(EXECUTABLE)
.PHONY: clean
$(INTERM_DIR) :
mkdir -p $#
$(INTERM_DIR)/%.dep: %.c
mkdir -p `dirname $#`
echo -n `dirname $#`/ > $#
$(CC) $(CFLAGS_COMMON) $< -MM | sed -r -e 's,^(.*)\.o\s*\:,\1.o $# :,g' >> $#
ifneq ($(MAKECMDGOALS),clean)
-include $(SOURCE_FILES:./%.c=./$(INTERM_DIR)/%.dep)
endif
$(INTERM_DIR)/%.o: ./%.c
mkdir -p `dirname $#`
$(CC) $(CFLAGS) -c $< -o $#
$(EXECUTABLE): $(SOURCE_FILES:./%.c=./$(INTERM_DIR)/%.o)
mkdir -p `dirname $#`
$(CC) $^ $(LIBFLAGS) -o $#
The error I got:
C:\cygwin64\bin\bash.exe -c 'C:/Program Files/mingw-w64/x86_64-7.1.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc.exe' -MM
gcc.exe: fatal error: no input files
compilation terminated.
COMPILE FILE FAILED (exit value 1, total time: 306ms)
I believe when you install Visual Studio it gives the option to run with Linux. Another way you might be able to get around this is to use a VM with a Linux OS.
I have a makefile and while attempting to compile it with make -f Makefile.linux it's giving the error:
make: Nothing to be done for 'all'
I've looked around and haven't found a solution to this. Some others have had a similar problem before but their solutions do not seem to work for me.
Here's my code:
FCOMPL=/usr/bin/g77 -m32
FCOM90=gfortran -m32
FFLAGC=-u -Wall -ff2c -fPIC -O
BINDIR=/ami/bin/linux-x86
OLDBIN=/ami/bin/linux-x86/old
LIBDIR=/ami/lib/linux-x86
X11LIB=/usr/X11R6/lib
BLDDIR=./
LIBS=-L/mrao/lib -lutil -lio -lch -lpgplot -L$(X11LIB) -lX11
SOURCE_FILES=./make_sources
include $(SOURCE_FILES)
.SUFFIXES : .f90
.f.o:
$(FCOMPL) -c $(FFLAGC) $<
.f90.o:
$(FCOM90) -c $(FFLAGC) $<
#all:profile
libprofile.a : $(OBJECTS)
ar ru libprofile.a $(OBJECTS)
profile: profile.f90 libprofile.a
$(FCOM90) $(FFLAGC) -o profile.linux profile.f90 \
-L$(BLDDIR) -lprofile \
-L$(LIBDIR) -lsla -lnag77 -lcfitsio $(LIBS)
ln -s profile.linux profile
chmod g+w *.o *.mod *.a profile.linux
install: profile
mv $(BINDIR)/profile $(OLDBIN)/profile
cp -p profile.linux $(BINDIR)/profile
chmod g+w $(BINDIR)/profile
previous:
mv $(OLDBIN)/profile $(BINDIR)/profile
clean:
rm profile.linux profile *.o *.mod *.a
Solved.
This can be fixed by typing:
make clean -f Makefile.linux
followed by
make -f Makefile.linux
I just came across this makefile, and it's confusing to me:
PROJECT_ROOT = ../..
LIBDIR = $(PROJECT_ROOT)/src/lib
INCDIR = $(PROJECT_ROOT)/include
SRCS = proj_start.c function1.c
LIBS = $(LIBDIR)/libtest.a
OBJS = $(SRCS:.c=.o)
PROJECT = project1
FLAGS = -I$(INCDIR)
CC = gcc $(FLAGS)
.c.o:
$(CC) -c $<
$(PROJECT): $(OBJS)
$(CC) $(OBJS) $(LIBS) -o $#
it: $(PROJECT)
clean:
rm -f $(OBJS) $(PROJECT)
depend: $(SRCS)
$(CC) -M $(SRCS) > dependList
sed -e '1,/^# DO NOT DELETE/!d' Makefile > make.tmp
cat dependList >> make.tmp
mv make.tmp Makefile
rm dependList
# DO NOT DELETE THIS LINE
These are the parts that confuse me:
LIBDIR = $(PROJECT_ROOT)/src/lib
Why is LIBDIR in the root/src/lib library?
Shouldn't it be the root/lib directory (both directories are present in the file hierarchy)?
.c.o:
$(CC) -c $<
What the heck does this do? The "$<" evaluates to .c.o? I see that it is a 'suffix rule' but what are they really used for?
depend: $(SRCS)
$(CC) -M $(SRCS) > dependList
sed -e '1,/^# DO NOT DELETE/!d' Makefile > make.tmp
cat dependList >> make.tmp
mv make.tmp Makefile
rm dependList
# DO NOT DELETE THIS LINE
Why do we need this part? It seems all the dependencies have already been handled...?
Yeah, putting lib/ under src/ looks like a bad, counterintuitive design.
This:
.c.o:
...
is the old way of writing an implicit rule. These days we'd write it like this:
%.o: %.c
...
It's a slightly Rube Goldberg (i.r. clever but over-complicated) way of doing automatic dependency handling. So if foo.c contains the line #include bar.h, this rule will append the line foo.o: bar.h to the makefile. This is actually important.
I just install qt on my slax box,
And I tried to write and compile using qmake.
But the problem is qmake does not write it's 'Makefile' to include -Lqt-mt or -Lqt.
I have to give it manually otherwise there are unresolved links are there. What I could
do for this?Any workaround on this?
And this is the 'Makefile' output by the qmake.
#############################################################################
# Makefile for building: hello
# Generated by qmake (2.01a) (Qt 4.5.3) on: Tue Feb 2 04:04:03 2010
# Project: hello_world.pro
# Template: app
# Command: /usr/bin/qmake -unix -o Makefile hello_world.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES =
CFLAGS = -pipe $(DEFINES)
CXXFLAGS = -pipe $(DEFINES)
INCPATH = -I/usr/lib/qt-3.3.8b/mkspecs/linux-g++ -I.
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS)
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = $(COPY_FILE)
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = hello_world.cpp
OBJECTS = hello_world.o
DIST = hello_world.pro
QMAKE_TARGET = hello
DESTDIR =
TARGET = hello
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$#" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: hello_world.pro /usr/lib/qt-3.3.8b/mkspecs/linux-g++/qmake.conf
$(QMAKE) -unix -o Makefile hello_world.pro
qmake: FORCE
#$(QMAKE) -unix -o Makefile hello_world.pro
dist:
#$(CHK_DIR_EXISTS) .tmp/hello1.0.0 || $(MKDIR) .tmp/hello1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/hello1.0.0/ && (cd `dirname .tmp/hello1.0.0` && $(TAR) hello1.0.0.tar hello1.0.0 && $(COMPRESS) hello1.0.0.tar) && $(MOVE) `dirname .tmp/hello1.0.0`/hello1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/hello1.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
compiler_clean:
####### Compile
hello_world.o: hello_world.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o hello_world.o hello_world.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
And here is my .pro file that I used.
TEMPLATE=app
CONFIG+= qt warn_on release
HEADERS=
SOURCES=hello_world.cpp
TARGET=hello
I already set the $QTDIR and I think everything is in place.
Where I missed? Why I have to give it manually? Why qmake does not work in first
place?
EDIT:
There in makefile
LIBS = $(SUBLIBS)
What I did is change it to,
LIBS = $(SUBLIBS) -lqt-mt
After I changed everything works fine ! The problem is again , why I have to do such
a thing manually?
FOR #Frank Osterfeld
I think I'm using correct 'qmake' because ,
When I hit, qmake --version , I do get this.
QMake version 2.01a
Using Qt version 4.5.3 in /usr/lib/qt/lib
--Thanks in advance--
When there are multiple Qt installations on a machine, it's important the environment has been set-up properly to point to the right Qt version. The following are important environment variables to check:
$QTDIR -- should point to the base directory for the Qt installation.
$QMAKESPEC -- should point to a make specification directory under $QTDIR (e.g. $QTDIR/mkspecs/linux-g++).
$QT_PLUGIN_PATH -- should point to the plug-in directory, typically within the Qt installation (e.g. $QTDIR/plugins).
$PATH -- should have the $QTDIR/bin directory within it. The installation that you wish to use should be first within the $PATH.
If all else fails, check your full environment to ensure that the correct Qt installation is being referred to (use env on *nix, set on Windows).
If you notice directories pointing to the wrong installation within the Makefile generated by qmake, it is likely that your environment hasn't been properly set (in this case, $QMAKESPEC was the culprit).
Finally, it's important to note that the libraries from Qt3 are no longer present in Qt4: Qt3 has libqt-mt, libqui, etc. Qt4 has libQtCore, libQtGui, etc.