Added ability to directly embed NED programs in NEDsim binary for runtime execution.
[screensavers] / hacks / NEDsim / Makefile
index 693eaed..dd1f25b 100644 (file)
@@ -39,15 +39,26 @@ DEFINES  = -DGETTIMEOFDAY_TWO_ARGS -DHAVE_UNISTD_H
 # comprise the screenhack library and link them directly into the binary.
 SCREENHACK_SRC != ls -1 ../../screenhack/*.c
 
 # comprise the screenhack library and link them directly into the binary.
 SCREENHACK_SRC != ls -1 ../../screenhack/*.c
 
+# Create NED_OBJ containing a list of object files with embedded NED1 machine
+# code which should be linked to the NEDsim binary.
+.SUFFIXES: .ned_asm
+NED_SRC != ls ned_programs/*.ned_asm
+NED_OBJ := $(NED_SRC:.ned_asm=.o)
+
 ################################################################################
 # Targets
 ################################################################################
 
 ################################################################################
 # Targets
 ################################################################################
 
-all:
-       @$(CC) $(CC_FLAGS) $(DEFINES) $(INC_PATH) $(LIB_PATH) $(LIBS) -o NEDsim NEDsim.c simulator.c $(SCREENHACK_SRC)
+all: embed
+       @$(CC) $(CC_FLAGS) $(DEFINES) $(INC_PATH) $(LIB_PATH) $(LIBS) \
+                       -o NEDsim NEDsim.c simulator.c $(SCREENHACK_SRC) $(NED_OBJ)
+
+embed:
+       @cd ned_programs && make all && cd ..
 
 clean:
 
 clean:
-       @rm -f NEDsim NEDsim.core
+       @cd ned_programs && make clean && cd ..
+       @rm -f NEDsim NEDsim.core *.o
 
 run: clean all
        @echo ""
 
 run: clean all
        @echo ""