A.Compile cpp2html.c to produce cpp2html.o - unix

Your makefile does too much work when only cpp2html.c has been changed:
gcc -g -c cpp2html.c
gcc -g cpp2html.o lex.yy.o
gcc -g -DDEBUG cpp2html.o lex.yy.o -o cpp2html
does not work, I have tried almost every sequence. My code follows:
cpp2html: cpp2html.o lex.yy.o
gcc {g cpp2html.o lex.yy.o
gcc -g -DDEBUG cpp2html.o lex.yy.o -o cpp2html
cpp2html.o: cpp2html.c
gcc -g -c cpp2html.c
lex.yy.c: cppscanner.l
flex cppscanner.l
lex.yy.o: lex.yy.c
gcc -g -c lex.yy.c

As mentioned in the comments, taking the first gcc out solves the problem.

Related

How to silence or suppress gfortran (or clang?) backend in conda?

I have been working on building a very particular conda environment designed for python and R with cross-talk using rpy2. The recipe I came up with that works to install the proper R packages is the following:
# install_main_environment.sh
now=$(date +"%T")
echo "Start Time: $now"
## Create Main Environment (OSX-64)
conda create -n python3 python=3 --yes
source activate python3
## Jupyter
conda install jupyterlab --yes
## R
conda install -c r r --yes
conda install -c r r-essentials --yes
conda install -c r rstudio --yes
conda install gfortran_osx-64 --yes
conda install -c anaconda clangxx_osx-64 --yes
conda install rpy2 --yes
## Install Python Packages
source ./install_python_packages.sh
## Install R Packages
RScript ./install_r_packages.r
# End
now=$(date +"%T")
echo "End Time: $now"
However, one of these lines has made the backend extremely verbose so everytime I source/deactivate an environment or install a package I get a very verbose backend.
How can I suppress this or silence the extra text permanently? In my bash profile when I activate my environment, I direct the stderr & stdout to /dev/null source activate python3 > /dev/null 2>&1 but this is only a patch that is not universal.
This situation exists for both my work computer:
OSX 10.11.6 (El Capitan) and my personal computer OSX Sierra.
Here is an example of the output I am referring to below:
jespinozlt-osx:~ jespinoz$ source activate python3
INFO: activate-gfortran_osx-64.sh made the following environmental changes:
+DEBUG_FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
+F95=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-gfortran
+FC=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-gfortran
+FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+FORTRANFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+GFORTRAN=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-gfortran
INFO: activate_clang_osx-64.sh made the following environmental changes:
+AR=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-ar
+AS=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-as
+CC=x86_64-apple-darwin13.4.0-clang
+CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe
+CHECKSYMS=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-checksyms
+CLANG=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-clang
+CODESIGN_ALLOCATE=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-codesign_allocate
+CONDA_BUILD_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
+CPPFLAGS=-D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9
+DEBUG_CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -Og -g -Wall -Wextra
+INDR=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-indr
+INSTALL_NAME_TOOL=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-install_name_tool
+LD=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-ld
+LDFLAGS=-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs
+LDFLAGS_LD=-pie -headerpad_max_install_names -dead_strip_dylibs
+LIBTOOL=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-libtool
+LIPO=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-lipo
+NM=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-nm
+NMEDIT=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-nmedit
+OTOOL=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-otool
+PAGESTUFF=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-pagestuff
+RANLIB=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-ranlib
+REDO_PREBINDING=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-redo_prebinding
+SEGEDIT=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-segedit
+SEG_ADDR_TABLE=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-seg_addr_table
+SEG_HACK=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-seg_hack
+SIZE=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-size
+STRINGS=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-strings
+STRIP=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-strip
+_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_apple_darwin13_4_0
INFO: activate_clangxx_osx-64.sh made the following environmental changes:
+CLANGXX=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-clang++
+CXX=x86_64-apple-darwin13.4.0-clang++
+CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0
+DEBUG_CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -Og -g -Wall -Wextra
Below are links to pastebin for requested outputs/scripts:
As suggested by Tarun Lalwani in comments:
Stdout
bash -xlc "source activate python3" 1> activate_output.o
Stderr
bash -xlc "source activate python3" 2> activate_output.e
Scripts requested by Trishansh Bhardwaj and Tarun Lalwani in comments:
Script
Associated scripts
If you look at the below folders
/Users/jespinoz/anaconda/envs/python3/etc/conda
There is a activate.d and deactivate.d folder inside the same, which gets executed, during activate and deactivate
These files have below code section
if [ $? -ne 0 ]; then
echo "ERROR: $(_get_sourced_filename) failed, see above for details"
else
if [ -f /tmp/new-env-$$.txt ]; then
rm -f /tmp/new-env-$$.txt || true
fi
env > /tmp/new-env-$$.txt
echo "INFO: $(_get_sourced_filename) made the following environmental changes:"
diff -U 0 -rN /tmp/old-env-$$.txt /tmp/new-env-$$.txt | tail -n +4 | grep "^-.*\|^+.*" | grep -v "CONDA_BACKUP_" | sort
fi
rm -f /tmp/old-env-$$.txt /tmp/new-env-$$.txt || true
You need to comment these to disable the verbose output. This code basically saves current env to a file and then run the activation code, capture env again and print the diff

make: *** No rule to make target `cookie.h', needed by `mainProg.o'. Stop. Your makefile does not build 'playChomp' when invoked:playChomp

Error i get!-----------------/
This is what my makefile looks like/
i am trying to Compile cookie.cpp to produce cookie.o.
Compile mainProg.cpp to produce mainProg.o.
Link the the .o files to produce an executable program named playChomp
mainprog.cpp' file has the header of cookie.h
i am working in unix in an ssh terminal linux server
makefile..
**all: playChomp
playChomp: mainProg.o cookie.o cookie.h
g++ -g -DDEBUG mainProg.o cookie.o -o playChomp
cookie.o:cookie.cpp
g++ -g -DDEBUG -c cookie.cpp
mainProg.o: mainProg.cpp cookie.h
g++ -g -DDEBUG -c mainProg.cpp**
You need to post some basic information that helps the people to understand better your problem. A few suggestions:
Try making a more meaningful title, put the error message that you receive into the title.
Put the source code of your program into your post. If possible, try to reduce it to a minimum content that still generates the same error message.
Inform your Operational System, Language that you are working on, what version, etc.
Given the following directory listing:
$ ls
cookie.cpp cookie.h mainProg.cpp Makefile
Then the Makefile you have provided:
all: playChomp
playChomp: mainProg.o cookie.o cookie.h
g++ -g -DDEBUG mainProg.o cookie.o -o playChomp
cookie.o: cookie.cpp
g++ -g -DDEBUG -c cookie.cpp
mainProg.o: mainProg.cpp cookie.h
g++ -g -DDEBUG -c mainProg.cpp
Will produce the desired executable:
$ make all
g++ -g -DDEBUG -c mainProg.cpp
g++ -g -DDEBUG -c cookie.cpp
g++ -g -DDEBUG mainProg.o cookie.o -o playChomp
$ ./playChomp
Hello World!
The error you are getting suggests the file is not there (in the directory where you are executing make). Ensure that you are calling make from the directory where those files exist, and triple check the spelling (i.e. make sure you have cookie.h, not Cookie.h, etc.)

How to build QT Project from terminal MacOS X

For example, lets take a default QT widget application that we get. So instead of using QT Creator if we want to build using the terminal then what is the way to do that?
Basically we want to produce the build for the project which actually also contains the dmg file.
Compile output when done using QT Creator shown is below when no change is done :
14:37:04: Running steps for project QTDefaultProj...
14:37:04: Configuration unchanged, skipping qmake step.
14:37:04: Starting: "/usr/bin/make"
make: Nothing to be done for `first'.
14:37:05: The process "/usr/bin/make" exited normally.
14:37:05: Elapsed time: 00:00.
Compile Output after changing the directory :
15:31:50: Running steps for project QTDefaultProj...
15:31:50: Starting: "/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/bin/qmake" /Users/arqam/Desktop/Junk/QTDefaultProj/QTDefaultProj.pro -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug
Info: creating stash file /Users/arqam/Desktop/Junk/build-QTDefaultProj-Desktop_Qt_5_10_0_clang_64bit-Debug-2/.qmake.stash
15:31:50: The process "/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/bin/qmake" exited normally.
15:31:50: Starting: "/usr/bin/make" qmake_all
make: Nothing to be done for `qmake_all'.
15:31:51: The process "/usr/bin/make" exited normally.
15:31:51: Starting: "/usr/bin/make"
/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/bin/uic ../QTDefaultProj/mainwindow.ui -o ui_mainwindow.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../QTDefaultProj -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtWidgets.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtGui.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/mkspecs/macx-clang -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -o main.o ../QTDefaultProj/main.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../QTDefaultProj -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtWidgets.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtGui.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/mkspecs/macx-clang -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -o mainwindow.o ../QTDefaultProj/mainwindow.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wall -W -dM -E -o moc_predefs.h ../../ImageToCartoon/QT/5.10.0/clang_64/mkspecs/features/data/dummy.cpp
/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include ./moc_predefs.h -I/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/mkspecs/macx-clang -I/Users/arqam/Desktop/Junk/QTDefaultProj -I/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib/QtWidgets.framework/Headers -I/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib/QtGui.framework/Headers -I/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib ../QTDefaultProj/mainwindow.h -o moc_mainwindow.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../QTDefaultProj -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtWidgets.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtGui.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/mkspecs/macx-clang -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -o moc_mainwindow.o moc_mainwindow.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wl,-rpath,#executable_path/Frameworks -Wl,-rpath,/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -o QTDefaultProj.app/Contents/MacOS/QTDefaultProj main.o mainwindow.o moc_mainwindow.o -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
15:31:55: The process "/usr/bin/make" exited normally.
15:31:55: Elapsed time: 00:05.
With help from m7913d I am finally able to build the QT project from terminal without using QT Creator.
So steps are :
Create an empty folder name it as build-debug for example.
Inside your build-debug folder run the following command :
pathToQTDirectory/QT/5.10.0/clang_64/bin/qmake pathToQTProjectFolder/MyProject/
/usr/bin/make qmake_all
/usr/bin/make
If the above doesn't work then try seeing in the QT Creator compiler output the steps involved when you specify a new directory as the build directory.

Makefile doing "too much work"

For my assignment, we are supposed to compile cpp2html.c to produce cpp2html.o. We are to do the same thing with lex.yy.c. lex.yy.c is created by the command flex cppscanner.l. Lastly, we're supposed to link the .o files together to produce an executable program named cpp2html.
My makefile is supposed to use gcc instead of g++, which I believe I am doing correctly. I've tried to get this specific makefile to work for this program for a few hours now, as the one for the g++ portion worked fine. When I submit this makefile, I'm told that "Your makefile does too much work when only cpp2html.c has been changed." I tried looking up this error, and was only able to find someone who had the error on the g++ portion; I tried adapting it, but it didn't work. I've tried changing the format of the makefile, I've tried altering the codes, but I just don't know what I'm doing wrong.
How can I alter my makefile to do what it needs to, without making it do "too much work"?
My makefile is as follows.
cpp2html: cpp2html.o lex.yy.o
gcc -g -DDEBUG cpp2html.o lex.yy.o
mv a.out cpp2html
cpp2html.o: cpp2html.c
gcc -g -DDEBUG -c cpp2html.c
flex cppscanner.l
lex.yy.o: lex.yy.c
gcc -g -c lex.yy.c
EDIT:
cpp2html: cpp2html.o lex.yy.o
gcc -g cpp2html.o lex.yy.o
gcc -g -DDEBUG cpp2html.o lex.yy.o -o cpp2html
cpp2html.o: cpp2html.c
gcc -g -c cpp2html.c
lex.yy.c: cppscanner.l
flex cppscanner.l
lex.yy.o: lex.yy.c
gcc -g -c lex.yy.c
This makefile should resolve this,
cpp2html: cpp2html.o lex.yy.o
gcc -g -DDEBUG cpp2html.o lex.yy.o -o cpp2html
cpp2html.o: cpp2html.c
gcc -g -DDEBUG -c cpp2html.c
lex.yy.o: lex.yy.c
gcc -g -c lex.yy.c
lex.yy.c: cppscanner.l
flex cppscanner.l -o lex.yy.c

Why does Gnumake from parent directory behave differently?

I am stumped as to why when I do a gnumake from the parent directory it behaves incorrectly, whereas, if I cd to the subdirectory and do gnumake it works correctly.
In the parent makefile, I have a rule like this:
.PHONY: zlib-1.2.5
zlib-1.2.5:
# echo Issuing $(MAKE) in $# ...
pushd zlib-1.2.5; make; popd
I also tried it like this for last line above with the same failure:
make -C zlib-1.2.5
Which gives different result than doing the same from the toplevel
pushd zlib-1.2.5; make; popd
There is a something from the parent makefile that is making its way into the subdirectory makefile and causing it to behave incorrectly, but I don't know how to find it.
The symptom I see is that the subdirectory config generated makefile rule for zlib misses the dependencies and I get this result going straight to the ar without generating the .o(s) first:
cd ~/src; make zlib-1.2.5
CPPFLAGS_AUTO = < >
Issuing make in zlib-1.2.5 ...
pushd zlib-1.2.5; make; popd
~/src/zlib-1.2.5 ~/src
make[1]: Entering directory `/disk2/user/src/zlib-1.2.5'
ar rc libz.a adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
ar: adler32.o: No such file or directory
make[1]: *** [libz.a] Error 1
gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -o libz.so.1.2.5 adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo -lc -L. libz.a
gcc: adler32.lo: No such file or directory
gcc: compress.lo: No such file or directory
gcc: crc32.lo: No such file or directory
gcc: deflate.lo: No such file or directory
[...]
make[1]: *** [libz.so.1.2.5] Error 1
make[1]: Target `all' not remade because of errors.
make[1]: Leaving directory `/disk2/user/src/zlib-1.2.5'
~/src
Versus from the zlib directory where it works correctly:
cd ~/src/zlib-1.2.5; make
gcc -O3 -D_LARGEFILE64_SOURCE=1 -c -o example.o example.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -c -o adler32.o adler32.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -c -o compress.o compress.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -c -o crc32.o crc32.c
[...]
gcc -O3 -D_LARGEFILE64_SOURCE=1 -c -o zutil.o zutil.c
ar rc libz.a adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
(ranlib libz.a || true) >/dev/null 2>&1
gcc -O3 -D_LARGEFILE64_SOURCE=1 -o example example.o -L. libz.a
gcc -O3 -D_LARGEFILE64_SOURCE=1 -c -o minigzip.o minigzip.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -o minigzip minigzip.o -L. libz.a
mkdir objs 2>/dev/null || test -d objs
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DPIC -c -o objs/adler32.o adler32.c
mv objs/adler32.o adler32.lo
mkdir objs 2>/dev/null || test -d objs
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DPIC -c -o objs/compress.o compress.c
mv objs/compress.o compress.lo
[...]
mkdir objs 2>/dev/null || test -d objs
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DPIC -c -o objs/zutil.o zutil.c
mv objs/zutil.o zutil.lo
gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -o libz.so.1.2.5 adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo -lc -L. libz.a
rm -f libz.so libz.so.1
ln -s libz.so.1.2.5 libz.so
ln -s libz.so.1.2.5 libz.so.1
rmdir objs
gcc -O3 -D_LARGEFILE64_SOURCE=1 -o examplesh example.o -L. libz.so.1.2.5
gcc -O3 -D_LARGEFILE64_SOURCE=1 -o minigzipsh minigzip.o -L. libz.so.1.2.5
gcc -O3 -D_LARGEFILE64_SOURCE=1 -o example64 example64.o -L. libz.a
gcc -O3 -D_LARGEFILE64_SOURCE=1 -o minigzip64 minigzip64.o -L. libz.a
run make -D to turn on debug
pushd zlib-1.2.5; make; popd
should be
make -C zlib-1.2.5
The -C flag/switch changes the directory similar to what your code does with the pushd and popd commands. The difference is in the behaviour since this make process is recursive. And actually, you might use $(MAKE) instead of make in the event that a command such as gmake is used instead of what might be BSD make (since it is a GNU makefile).

Resources