Skip to content

Commit

Permalink
Use CMake for automating the build process
Browse files Browse the repository at this point in the history
With subsequent directory structure reorganization.
  • Loading branch information
cyrus-and committed Jul 19, 2012
1 parent 81cc7e4 commit 0331c1a
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 29 deletions.
3 changes: 1 addition & 2 deletions .gitignore
@@ -1,2 +1 @@
/phpfs
*.o
/build-*/
36 changes: 11 additions & 25 deletions Makefile
@@ -1,31 +1,17 @@
.PHONY: clean mount umount reload
CFLAGS=-g -Wall -DDEBUG `pkg-config --cflags fuse` -DFUSE_USE_VERSION=29
LDFLAGS=-lfuse -lcurl
release debug: build

# EXE ]-------------------------------------------------------------------------
release: BUILD_DIR=./build-release/
release: BUILD_TYPE=Release

phpfs: main.o phpfs.o net.o $(patsubst %.c,%.o,$(wildcard fuse_api/*.c))
debug: BUILD_DIR=./build-debug/
debug: BUILD_TYPE=Debug

# OBJECTS ]---------------------------------------------------------------------

# generated by: gcc -D_FILE_OFFSET_BITS=64 -MM *.c
main.o: main.c phpfs.h debug.h net.h
net.o: net.c phpfs.h debug.h net.h
phpfs.o: phpfs.c phpfs.h debug.h net.h fuse_api/fuse_api.h

# UTILS ]-----------------------------------------------------------------------
build:
rm -fr $(BUILD_DIR)
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) && cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ../src/ && make

clean:
find -name '*.o' -delete
rm -f ./phpfs

# TEST ]------------------------------------------------------------------------

mount:
test -d /tmp/phpfs || mkdir /tmp/phpfs/
./phpfs 'http://localhost/phpfs/phpfs.php' /tmp/phpfs/

umount:
fusermount -u /tmp/phpfs/
rm -fr ./build-release/ ./build-debug/

reload: umount mount
.PHONY: build build-release build-debug clean
16 changes: 16 additions & 0 deletions src/CMakeLists.txt
@@ -0,0 +1,16 @@
cmake_minimum_required( VERSION 2.8 )
find_package( PkgConfig )

project( phpfs )

file( GLOB fuse_api fuse_api/*.c )
file( GLOB core *.c )
add_executable( phpfs ${core} ${fuse_api} )

add_definitions( -Wall )

find_package( CURL )
pkg_check_modules( FUSE REQUIRED fuse )
add_definitions( ${FUSE_CFLAGS} -DFUSE_USE_VERSION=29 )

target_link_libraries( phpfs ${CURL_LIBRARY} ${FUSE_LIBRARIES} )
2 changes: 1 addition & 1 deletion debug.h → src/debug.h
@@ -1,7 +1,7 @@
#ifndef _PHPFS_DEBUG_H
#define _PHPFS_DEBUG_H

#ifdef DEBUG
#ifndef NDEBUG

#include <stdio.h>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion phpfs.c → src/phpfs.c
Expand Up @@ -18,7 +18,7 @@ int phpfs_fuse_start( struct phpfs *phpfs , char *mounting_point )
argc = 0;
argv[ argc++ ] = "phpfs";
argv[ argc++ ] = "-s"; /* single thread */
#ifdef DEBUG
#ifndef NDEBUG
argv[ argc++ ] = "-d"; /* debug and core dump */
#endif
argv[ argc++ ] = mounting_point;
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 0331c1a

Please sign in to comment.