Use $(CC) and $(CXX) instead of hardcoding gcc and g++. Remove include and library paths we don't want. Include externally-supplied CFLAGS, CXXFLAGS, CPPFLAGS, LDFLAGS. Subverting make's ability to build in parallel is still terrible but I don't want to spend much more time fixing this ancient software. --- Makefile.orig 2007-07-06 17:46:11.000000000 -0500 +++ Makefile 2020-08-20 04:02:11.000000000 -0500 @@ -8,31 +8,32 @@ # -# LINUX and BSD CFLAGS -CFLAGS = -O3 -I/usr/include/pcap -I/usr/local/include/pcap -I./ -L/usr/lib/libsocket.so -g -L/opt/csw/lib -ggdb +# LINUX and BSD CFLAGS AND CXXFLAGS +CFLAGS := -O3 -g -ggdb -I. $(CPPFLAGS) $(CFLAGS) +CXXFLAGS := -O3 -g -ggdb -I. $(CPPFLAGS) $(CXXFLAGS) -# LINUX LFLAGS -LFLAGS = -lresolv -lnsl -lpcap -L/usr/lib/libpcap.so.0.6.2 +# LINUX LFLAGS +LFLAGS := -lresolv -lnsl -lpcap $(LDFLAGS) # BSD BFLAGS -BFLAGS = -lpcap -L/usr/lib/libpcap.so +BFLAGS := -lpcap $(LDFLAGS) final : sancp.cc Makefile - g++ -Wall $(CFLAGS) -c build_acl.cc -o build_acl.o - g++ -Wall $(CFLAGS) -c misc_functs.cc -o misc_functs.o - g++ -Wall $(CFLAGS) -c outputFileHandle.cc -o outputFileHandle.o - g++ -Wall $(CFLAGS) -c apply_rule.cc -o apply_rule.o - g++ -Wall $(CFLAGS) -c decode.cc -o decode.o - g++ -Wall $(CFLAGS) -c fileHandle.cc -o fileHandle.o - g++ -Wall $(CFLAGS) -c MemoryPool.cc -o MemoryPool.o - g++ -Wall $(CFLAGS) -c pcapFileHandle.cc -o pcapFileHandle.o - g++ -Wall $(CFLAGS) -c sancp.cc -o sancp.o - gcc -Wall $(CFLAGS) -c pcap_functions.c -o pcap_functions.o - g++ -Wall $(CFLAGS) -c permissions.cc -o permissions.o - g++ -Wall $(CFLAGS) -c check_packet.cc -o check_packet.o - g++ -Wall $(CFLAGS) -c statefull_logging.cc -o statefull_logging.o - g++ -Wall $(CFLAGS) -c help.cc -o help.o + $(CXX) -Wall $(CXXFLAGS) -c build_acl.cc -o build_acl.o + $(CXX) -Wall $(CXXFLAGS) -c misc_functs.cc -o misc_functs.o + $(CXX) -Wall $(CXXFLAGS) -c outputFileHandle.cc -o outputFileHandle.o + $(CXX) -Wall $(CXXFLAGS) -c apply_rule.cc -o apply_rule.o + $(CXX) -Wall $(CXXFLAGS) -c decode.cc -o decode.o + $(CXX) -Wall $(CXXFLAGS) -c fileHandle.cc -o fileHandle.o + $(CXX) -Wall $(CXXFLAGS) -c MemoryPool.cc -o MemoryPool.o + $(CXX) -Wall $(CXXFLAGS) -c pcapFileHandle.cc -o pcapFileHandle.o + $(CXX) -Wall $(CXXFLAGS) -c sancp.cc -o sancp.o + $(CC) -Wall $(CFLAGS) -c pcap_functions.c -o pcap_functions.o + $(CXX) -Wall $(CXXFLAGS) -c permissions.cc -o permissions.o + $(CXX) -Wall $(CXXFLAGS) -c check_packet.cc -o check_packet.o + $(CXX) -Wall $(CXXFLAGS) -c statefull_logging.cc -o statefull_logging.o + $(CXX) -Wall $(CXXFLAGS) -c help.cc -o help.o clean : @(echo "" > platform.h) @@ -41,10 +42,10 @@ bsd : @(echo "#define PLATFORM_BSD" > platform.h) @make final - g++ -Wall $(BFLAGS) $(CFLAGS) -o sancp sancp.o misc_functs.o check_packet.o statefull_logging.o build_acl.o apply_rule.o decode.o pcap_functions.o pcapFileHandle.o fileHandle.o MemoryPool.o permissions.o outputFileHandle.o help.o + $(CXX) -Wall $(BFLAGS) $(CXXFLAGS) -o sancp sancp.o misc_functs.o check_packet.o statefull_logging.o build_acl.o apply_rule.o decode.o pcap_functions.o pcapFileHandle.o fileHandle.o MemoryPool.o permissions.o outputFileHandle.o help.o linux : @(echo "#define PLATFORM_LINUX" > platform.h) @make final - g++ -Wall $(LFLAGS) $(CFLAGS) -o sancp sancp.o misc_functs.o check_packet.o statefull_logging.o build_acl.o apply_rule.o decode.o pcap_functions.o pcapFileHandle.o fileHandle.o MemoryPool.o permissions.o outputFileHandle.o help.o + $(CXX) -Wall $(LFLAGS) $(CXXFLAGS) -o sancp sancp.o misc_functs.o check_packet.o statefull_logging.o build_acl.o apply_rule.o decode.o pcap_functions.o pcapFileHandle.o fileHandle.o MemoryPool.o permissions.o outputFileHandle.o help.o