Skip to content

Commit

Permalink
Use the force-- I mean, the make!
Browse files Browse the repository at this point in the history
Makes `make json-check` a thing, and further teaches the makefile how to
`make chkjson` (or chkjson.exe, on Windows targets). Moves these out
from doc/contrib to src/chkjson, since they are (well) source files.

The new chkjson still depends on its own .cpp, the stub .h,
json.{h,cpp}, and the Makefile, which consists of the minimum
possible attack vector for Jenkins pull request security.
  • Loading branch information
narc0tiq committed Nov 24, 2013
1 parent 4a3b62d commit add62ee
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cataclysm
cataclysm-tiles
chkjson
!src/chkjson
data/*.template
save/
graveyard/
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ TARGET = cataclysm
TILESTARGET = cataclysm-tiles
W32TILESTARGET = cataclysm-tiles.exe
W32TARGET = cataclysm.exe
CHKJSON_BIN = chkjson
BINDIST_DIR = bindist
BUILD_DIR = $(CURDIR)
SRC_DIR = src
Expand Down Expand Up @@ -160,6 +161,7 @@ endif

# Global settings for Windows targets
ifeq ($(TARGETSYSTEM),WINDOWS)
CHKJSON_BIN = chkjson.exe
TARGET = $(W32TARGET)
BINDIST = $(W32BINDIST)
BINDIST_CMD = $(W32BINDIST_CMD)
Expand Down Expand Up @@ -332,11 +334,18 @@ $(SRC_DIR)/catalua.cpp: $(LUA_DEPENDENCIES)
localization:
lang/compile_mo.sh $(LANGUAGES)

$(CHKJSON_BIN): src/chkjson/chkjson.cpp src/json.cpp
$(CXX) -Isrc/chkjson -Isrc src/chkjson/chkjson.cpp src/json.cpp -o $(CHKJSON_BIN)

json-check: $(CHKJSON_BIN)
./$(CHKJSON_BIN)

clean: clean-tests
rm -rf $(TARGET) $(TILESTARGET) $(W32TILESTARGET) $(W32TARGET)
rm -rf $(ODIR) $(W32ODIR) $(W32ODIRTILES)
rm -rf $(BINDIST) $(W32BINDIST) $(BINDIST_DIR)
rm -f $(SRC_DIR)/version.h $(LUA_DIR)/catabindings.cpp
rm -f $(CHKJSON_BIN)

distclean:
rm -rf $(BINDIST_DIR)
Expand Down
22 changes: 0 additions & 22 deletions doc/contrib/make-chkjson.sh

This file was deleted.

15 changes: 0 additions & 15 deletions doc/contrib/verify_json.sh

This file was deleted.

11 changes: 11 additions & 0 deletions src/chkjson/catacharset.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Stub out additional requirements and butt in before real catacharset is included
*/
#ifndef CATACHARSET_H
#define CATACHARSET_H 1
#include <stdint.h>
#include <string>
std::string utf32_to_utf8(unsigned ch) {
return std::string("-stub-");
}
#endif
1 change: 0 additions & 1 deletion doc/contrib/chkjson.cpp → src/chkjson/chkjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// FILE I/O
#include <sys/stat.h>
#include <dirent.h>
#include "catacharset.h"
#include "json.h"

#include <string>
Expand Down

0 comments on commit add62ee

Please sign in to comment.