From 8ab082d84a6c5507681253236953a43977a221db Mon Sep 17 00:00:00 2001 From: Aaron Taylor Date: Thu, 8 Jul 2021 18:35:45 -0700 Subject: [PATCH] Added Makefile for NEDsim. --- hacks/NEDsim/Makefile | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 hacks/NEDsim/Makefile diff --git a/hacks/NEDsim/Makefile b/hacks/NEDsim/Makefile new file mode 100644 index 0000000..693eaed --- /dev/null +++ b/hacks/NEDsim/Makefile @@ -0,0 +1,58 @@ +############################################################# +# (c) 2021 Aaron Taylor # +# See LICENSE.txt file for copyright and license details. # +############################################################# + + +################################################################################ +# Configuration +################################################################################ + +# The below settings work on FreeBSD. Other UNIX-like systems should only +# require minor tweaks (e.g. LIB_PATH on Debian should be /usr/lib/ rather than +# /usr/local/lib/ and the compiler is gcc rather than cc). +CC = cc +CC_FLAGS = -Wall -pedantic -std=c99 +INC_PATH = -I../../screenhack/ -I/usr/local/include/ +LIB_PATH = -L/usr/local/lib/ +LIBS = -lm -lX11 -lXt + +# Many of the X-related header files contain named variadic macros. Suppress +# that warning so that we can enable -pedantic C89 compliance for our own code. +CC_FLAGS += -Wno-variadic-macros + +# Binary literals are not part of C, yet are used liberally in NEDsim. +CC_FLAGS += -Wno-gnu-binary-literal + +# These flags are normally set in config.h which is generated by the autoconf +# script as the initial step of the xscreensaver build process. The flags +# enable/disable code in the various screenhack library files. When compiling +# elsewhere than FreeBSD, these flags will likely need to be changed. If +# you're having trouble determing the correct flags to use, try running +# './configure' in an xscreensaver source tree and examining the generated +# config.h file. +DEFINES = -DGETTIMEOFDAY_TWO_ARGS -DHAVE_UNISTD_H + +# Since we're only building standalone hacks (i.e. building outside the +# xscreensaver tree/process) for testing and will later integrate them into the +# xscreensaver source tree, for now we simply slurp up all the C files that +# comprise the screenhack library and link them directly into the binary. +SCREENHACK_SRC != ls -1 ../../screenhack/*.c + +################################################################################ +# Targets +################################################################################ + +all: + @$(CC) $(CC_FLAGS) $(DEFINES) $(INC_PATH) $(LIB_PATH) $(LIBS) -o NEDsim NEDsim.c simulator.c $(SCREENHACK_SRC) + +clean: + @rm -f NEDsim NEDsim.core + +run: clean all + @echo "" + @echo "######################" + @echo "# Press 'q' to exit. #" + @echo "######################" + @echo "" + @./NEDsim -- 2.20.1