]> git.lizzy.rs Git - dungeon_game.git/commitdiff
Fix plugin target
authorElias Fleckenstein <eliasfleckenstein@web.de>
Wed, 9 Jun 2021 15:31:27 +0000 (17:31 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Wed, 9 Jun 2021 15:31:27 +0000 (17:31 +0200)
Makefile
README.md
plugins/apple/Makefile
plugins/apple/apple.c
plugins/game/Makefile
plugins/game/game.c
plugins/monster/Makefile
plugins/monster/monster.c

index 5241f4faea25cbf99b3de099f14bb8136c176667..01017e6a60a6dc0434b5f4361410118f4eb137ac 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,5 +3,6 @@ all: dungeon plugins
 dungeon: dungeon.c
        cc -g -o dungeon dungeon.c -ldl -D_GNU_SOURCE
 
-plugins:
-       make -f plugins/*/Makefile
+include plugins/*/Makefile
+
+plugins: ${PLUGINS}
index c608770be342111964a2a4d5ae06008ddd6a19f7..fbfc863cb6baec6398f3a272ef7962bf63a0e6a6 100644 (file)
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ You might want to include the game.h file from plugins/game/game.h. Have a look
 
 Controls: WASD to move, Q to quit.
 
-To build the loader and the plugins in the plugins/ folder, simply type `make` or `make all`. There are separate targets for the loader (`dungeon`) and the plugins. The plugins target simply triggerst all Makefiles that are placed in plugin directories, so you might want to include a makefile in your plugin.
+To build the loader and the plugins in the plugins/ folder, simply type `make` or `make all`. There are separate targets for the loader (`dungeon`) and the plugins. All Makefiles that are placed in plugin directories, so you might want to include a makefile in your plugin. The plugins target simply depends on ${PLUGINS}, so just add things to this in your plugin Makefile to add them to the plugins target (usually your plugin.so) 
 To run the loader, type `./dungeon`. It will load all plugins including the game itself dynamically and run the game.
 
 Plugins are loaded in alphabethical order, with the exception of the game plugin that is loaded first. If you want to make a plugin that depends on another plugin, make sure the other plugin is loaded first by setting the name of your plugin accordingly. A cleaner solution to this is coming soon.
index 8e3ccca9f1126a6935d9f879f1d0838019e44542..33c330338e54907d06ea48af561f9f8ccaaec56e 100644 (file)
@@ -1,2 +1,4 @@
-apple.so: apple.c ../game/game.h
-       cc -g -shared -fpic -o apple.so apple.c
+plugins/apple/apple.so: plugins/apple/apple.c plugins/game/game.h
+       cc -g -shared -fpic -o plugins/apple/apple.so plugins/apple/apple.c
+
+PLUGINS := ${PLUGINS} plugins/apple/apple.so
index 7c2de77d055f615a8e4566f8f7c0170ff3b84b3a..dd8a559edc19cabc2a13703ea4276a517c096368 100644 (file)
@@ -1,6 +1,6 @@
 #include <stddef.h>
 #include <stdlib.h>
-#include "dungeon.h"
+#include "../game/game.h"
 
 static struct entity apple;
 
index 83714da810713effa5bf1b6a1c16d50553ae8e0e..b8472f6091340644788ebbd4dc88d6045e675cb6 100644 (file)
@@ -1,2 +1,4 @@
-game.so: game.c game.h
-       cc -g -shared -fpic -o game.so game.c -lm -lpthread
+plugins/game/game.so: plugins/game/game.c plugins/game/game.h
+       cc -g -shared -fpic -o plugins/game/game.so plugins/game/game.c -lm -lpthread
+
+PLUGINS := ${PLUGINS} plugins/game/game.so
index f0496b88dcf3207cfee6c4812726d9271fafacc7..b2832147087e1d2ae0b53912bb62fe68de6e6e2b 100644 (file)
@@ -11,7 +11,7 @@
 #include <sys/ioctl.h>
 #include <math.h>
 #include <pthread.h>
-#include "dungeon.h"
+#include "game.h"
 
 bool running = true;
 
index 1ba16c52f449cd718e0286782ed106628e63f90a..28edde84324dced0243eee2027258056898079d4 100644 (file)
@@ -1,2 +1,4 @@
-monster.so: monster.c ../game/game.h
-       cc -g -shared -fpic -o monster.so monster.c
+plugins/monster/monster.so: plugins/monster/monster.c plugins/game/game.h
+       cc -g -shared -fpic -o plugins/monster/monster.so plugins/monster/monster.c
+
+PLUGINS := ${PLUGINS} plugins/monster/monster.so
index 167de88ed262eb6f4af0bfc6a26048d1d824ed26..6cb14ffd49de7ec60e72df098db0bb0801235b30 100644 (file)
@@ -1,6 +1,6 @@
 #include <stdlib.h>
 #include <stddef.h>
-#include "dungeon.h"
+#include "../game/game.h"
 
 static struct entity monster;