Quantcast
Channel: OS detecting makefile - Stack Overflow
Viewing all articles
Browse latest Browse all 15

Answer by ChrisInEdmonton for OS detecting makefile

$
0
0

Note that Makefiles are extremely sensitive to spacing. Here's an example of a Makefile that runs an extra command on OS X and which works on OS X and Linux. Overall, though, autoconf/automake is the way to go for anything at all non-trivial.

UNAME := $(shell uname -s)CPP = g++CPPFLAGS = -pthread -ansi -Wall -Werror -pedantic -O0 -g3 -I /nexopia/includeLDFLAGS = -pthread -L/nexopia/lib -lboost_systemHEADERS = data_structures.h http_client.h load.h lock.h search.h server.h thread.h utility.hOBJECTS = http_client.o load.o lock.o search.o server.o thread.o utility.o vor.oall: vorclean:    rm -f $(OBJECTS) vorvor: $(OBJECTS)    $(CPP) $(LDFLAGS) -o vor $(OBJECTS)ifeq ($(UNAME),Darwin)    # Set the Boost library location    install_name_tool -change libboost_system.dylib /nexopia/lib/libboost_system.dylib vorendif%.o: %.cpp $(HEADERS) Makefile    $(CPP) $(CPPFLAGS) -c $

Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>