Add make format rule

This commit is contained in:
2025-09-09 10:05:07 +02:00
parent 79f5aadc89
commit edca8806cf
10 changed files with 35 additions and 27 deletions
+1
View File
@@ -3,3 +3,4 @@
/librefront-headless /librefront-headless
/perf.data* /perf.data*
/massif.out* /massif.out*
/*~
+6 -1
View File
@@ -41,7 +41,7 @@ SERVER_LDFLAGS := $(COMMON_LDFLAGS)
CLIENT := librefront CLIENT := librefront
SERVER := librefront-headless SERVER := librefront-headless
.PHONY: all clean .PHONY: all clean format
all: $(CLIENT) $(SERVER) all: $(CLIENT) $(SERVER)
@@ -66,6 +66,11 @@ build/server/%.o: $(SRC_DIR)/server/%.c
clean: clean:
$(RM) -r build/ $(CLIENT) $(SERVER) perf.data* massif.out* $(RM) -r build/ $(CLIENT) $(SERVER) perf.data* massif.out*
format:
find $(SRC_DIR) -type f \( -name '*.c' -o -name '*.h' \) \
-exec sh -c 'tmp=$$(mktemp) || tmp=/tmp/indent.$$$$; \
indent -gnu "$$1" -o "$$tmp" && mv "$$tmp" "$$1"' _ {} \;
-include $(COMMON_DEP) -include $(COMMON_DEP)
-include $(CLIENT_DEP) -include $(CLIENT_DEP)
-include $(SERVER_DEP) -include $(SERVER_DEP)
+1
View File
@@ -9,6 +9,7 @@ pkgs.mkShellNoCC {
glib glib
gcc gcc
indent
pkg-config pkg-config
cloc cloc
valgrind valgrind
+4 -2
View File
@@ -30,14 +30,16 @@ GfxContext_new ()
if (!self->window) if (!self->window)
{ {
g_critical ("Couldn't create window for context %p: %s", self, SDL_GetError ()); g_critical ("Couldn't create window for context %p: %s", self,
SDL_GetError ());
} }
self->renderer = SDL_CreateRenderer (self->window, NULL); self->renderer = SDL_CreateRenderer (self->window, NULL);
if (!self->window) if (!self->window)
{ {
g_critical ("Couldn't create renderer for context %p: %s", self, SDL_GetError ()); g_critical ("Couldn't create renderer for context %p: %s", self,
SDL_GetError ());
} }
return self; return self;
-1
View File
@@ -26,4 +26,3 @@ typedef struct GameState
GArray *players; GArray *players;
Player *me; Player *me;
} GameState; } GameState;
-1
View File
@@ -1,2 +1 @@
#include "world.h" #include "world.h"
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
int main () int
main ()
{ {
fprintf (stderr, "Server not implemented!\n"); fprintf (stderr, "Server not implemented!\n");
return -1; return -1;