2014-08-19 04:32:52 +00:00
|
|
|
OS=$(shell uname)
|
2014-08-30 10:51:50 +00:00
|
|
|
ifeq ($(OS),Darwin)
|
2014-08-21 21:35:51 +00:00
|
|
|
OSQUERYD_PLIST_PATH="/Library/LaunchDaemons/com.facebook.osqueryd.plist"
|
2014-08-30 10:51:50 +00:00
|
|
|
endif
|
2014-08-21 21:35:51 +00:00
|
|
|
ROCKSDB_PATH="/tmp/rocksdb-osquery"
|
2014-08-19 04:32:52 +00:00
|
|
|
|
2014-09-05 14:54:41 +00:00
|
|
|
all: build
|
2014-07-31 00:35:19 +00:00
|
|
|
|
2014-08-19 04:32:52 +00:00
|
|
|
ammend:
|
|
|
|
git add .
|
|
|
|
git commit --amend --no-edit
|
|
|
|
|
2014-07-31 00:35:19 +00:00
|
|
|
.PHONY: build
|
2014-09-05 14:54:41 +00:00
|
|
|
build: tables
|
2014-07-31 00:35:19 +00:00
|
|
|
mkdir -p build
|
2014-09-05 14:54:41 +00:00
|
|
|
cd build && cmake .. && make $(MAKEFLAGS)
|
2014-07-31 00:35:19 +00:00
|
|
|
|
2014-08-19 04:32:52 +00:00
|
|
|
clean: clean_tables
|
2014-07-31 00:35:19 +00:00
|
|
|
cd build && make clean
|
2014-08-19 04:32:52 +00:00
|
|
|
|
2014-08-30 10:51:50 +00:00
|
|
|
ifeq ($(OS),Darwin)
|
2014-08-21 21:35:51 +00:00
|
|
|
clean_install:
|
|
|
|
rm -rf /var/osquery
|
|
|
|
rm -rf $(ROCKSDB_PATH)
|
|
|
|
rm -f /usr/local/bin/osqueryi
|
|
|
|
rm -f /usr/local/bin/osqueryd
|
2014-09-02 22:36:44 +00:00
|
|
|
rm -rf /var/log/osquery
|
2014-08-21 21:35:51 +00:00
|
|
|
if [ -f $(OSQUERYD_PLIST_PATH) ]; then launchctl unload $(OSQUERYD_PLIST_PATH); fi;
|
|
|
|
rm -f $(OSQUERYD_PLIST_PATH)
|
2014-08-30 10:51:50 +00:00
|
|
|
endif
|
2014-08-21 21:35:51 +00:00
|
|
|
|
2014-08-19 04:32:52 +00:00
|
|
|
clean_tables:
|
2014-08-06 23:33:54 +00:00
|
|
|
rm -rf osquery/tables/generated
|
2014-07-31 00:35:19 +00:00
|
|
|
|
|
|
|
deps:
|
2014-08-19 04:32:52 +00:00
|
|
|
git submodule init
|
|
|
|
git submodule update
|
2014-07-31 00:35:19 +00:00
|
|
|
pip install -r requirements.txt
|
2014-08-19 04:32:52 +00:00
|
|
|
ifeq ($(OS),Darwin)
|
2014-09-02 17:10:44 +00:00
|
|
|
brew install cmake || brew upgrade cmake
|
|
|
|
brew install boost --c++11 --with-python \
|
|
|
|
|| brew upgrade boost --c++11 --with-python
|
|
|
|
brew install gflags || brew upgrade gflags
|
|
|
|
brew install glog || brew ugprade glog
|
|
|
|
brew install snappy || brew upgrade snappy
|
|
|
|
brew install readline || brew upgrade readline
|
2014-08-19 04:32:52 +00:00
|
|
|
endif
|
2014-07-31 00:35:19 +00:00
|
|
|
|
2014-08-19 04:32:52 +00:00
|
|
|
distclean: clean_tables
|
|
|
|
ifeq ($(OS),Darwin)
|
2014-08-20 08:16:56 +00:00
|
|
|
rm -rf package/darwin/build
|
2014-08-19 04:32:52 +00:00
|
|
|
endif
|
2014-07-31 00:35:19 +00:00
|
|
|
rm -rf build
|
|
|
|
|
2014-08-15 07:25:30 +00:00
|
|
|
format:
|
|
|
|
clang-format -i osquery/**/*.h
|
|
|
|
clang-format -i osquery/**/*.cpp
|
2014-08-20 03:19:17 +00:00
|
|
|
clang-format -i osquery/**/*.mm
|
2014-08-20 07:58:27 +00:00
|
|
|
clang-format -i tools/*.cpp
|
2014-08-15 07:25:30 +00:00
|
|
|
|
2014-08-19 04:32:52 +00:00
|
|
|
.PHONY: package
|
|
|
|
package: all
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
ifeq ($(OS),Darwin)
|
2014-08-20 08:16:56 +00:00
|
|
|
packagesbuild -v package/darwin/osquery.pkgproj
|
|
|
|
mkdir -p build/darwin
|
|
|
|
mv package/darwin/build/osquery.pkg build/darwin/osquery.pkg
|
|
|
|
rm -rf package/darwin/build
|
2014-08-19 04:32:52 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
pull:
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
git submodule foreach git pull origin master
|
|
|
|
git fetch origin
|
|
|
|
git rebase master --stat
|
|
|
|
|
2014-08-20 05:02:18 +00:00
|
|
|
tables:
|
2014-08-19 04:32:52 +00:00
|
|
|
python tools/gentables.py
|
|
|
|
|
|
|
|
test:
|
2014-09-02 18:08:49 +00:00
|
|
|
cd build && cmake .. && make test
|
|
|
|
|
|
|
|
runtests: build test
|