Added Makefile for NEDsim.
[screensavers] / hacks / NEDsim / Makefile
CommitLineData
8ab082d8
AT
1#############################################################
2# (c) 2021 Aaron Taylor <ataylor at subgeniuskitty dot com> #
3# See LICENSE.txt file for copyright and license details. #
4#############################################################
5
6
7################################################################################
8# Configuration
9################################################################################
10
11# The below settings work on FreeBSD. Other UNIX-like systems should only
12# require minor tweaks (e.g. LIB_PATH on Debian should be /usr/lib/ rather than
13# /usr/local/lib/ and the compiler is gcc rather than cc).
14CC = cc
15CC_FLAGS = -Wall -pedantic -std=c99
16INC_PATH = -I../../screenhack/ -I/usr/local/include/
17LIB_PATH = -L/usr/local/lib/
18LIBS = -lm -lX11 -lXt
19
20# Many of the X-related header files contain named variadic macros. Suppress
21# that warning so that we can enable -pedantic C89 compliance for our own code.
22CC_FLAGS += -Wno-variadic-macros
23
24# Binary literals are not part of C, yet are used liberally in NEDsim.
25CC_FLAGS += -Wno-gnu-binary-literal
26
27# These flags are normally set in config.h which is generated by the autoconf
28# script as the initial step of the xscreensaver build process. The flags
29# enable/disable code in the various screenhack library files. When compiling
30# elsewhere than FreeBSD, these flags will likely need to be changed. If
31# you're having trouble determing the correct flags to use, try running
32# './configure' in an xscreensaver source tree and examining the generated
33# config.h file.
34DEFINES = -DGETTIMEOFDAY_TWO_ARGS -DHAVE_UNISTD_H
35
36# Since we're only building standalone hacks (i.e. building outside the
37# xscreensaver tree/process) for testing and will later integrate them into the
38# xscreensaver source tree, for now we simply slurp up all the C files that
39# comprise the screenhack library and link them directly into the binary.
40SCREENHACK_SRC != ls -1 ../../screenhack/*.c
41
42################################################################################
43# Targets
44################################################################################
45
46all:
47 @$(CC) $(CC_FLAGS) $(DEFINES) $(INC_PATH) $(LIB_PATH) $(LIBS) -o NEDsim NEDsim.c simulator.c $(SCREENHACK_SRC)
48
49clean:
50 @rm -f NEDsim NEDsim.core
51
52run: clean all
53 @echo ""
54 @echo "######################"
55 @echo "# Press 'q' to exit. #"
56 @echo "######################"
57 @echo ""
58 @./NEDsim