include common.mk
-PHONY += directories
-MKDIR_P = mkdir -p
-OBJ_DIR = bin
-
-CPP_SOURCES := $(wildcard *.cpp)
-
-HEADERS := $(wildcard *.h)
-
-OBJECTS := $(CPP_SOURCES:%.cpp=$(OBJ_DIR)/%.o) $(C_SOURCES:%.c=$(OBJ_DIR)/%.o)
-
-CFLAGS := -Wall -O3 -g
-CFLAGS += -I.
-LDFLAGS := -ldl -lrt -rdynamic -g
-SHARED := -shared
-
-# Mac OSX options
-ifeq ($(UNAME), Darwin)
-LDFLAGS := -ldl
-SHARED := -Wl,-undefined,dynamic_lookup -dynamiclib
-endif
-
-MARKDOWN := ../docs/Markdown/Markdown.pl
-
-all: directories ${OBJ_DIR}/$(LIB_SO) test
-
-directories: ${OBJ_DIR}
-
-test: bin/lib_iotcloud.so
- g++ -g -O3 Test.C -L./bin/ -l_iotcloud -lpthread -lbsd -o bin/Test
-
-${OBJ_DIR}:
- ${MKDIR_P} ${OBJ_DIR}
-
-debug: CFLAGS += -DCONFIG_DEBUG
-debug: all
-
-
-PHONY += docs
-docs: $(C_SOURCES) $(HEADERS)
- doxygen
-
-${OBJ_DIR}/$(LIB_SO): $(OBJECTS)
- $(CXX) -g $(SHARED) -o ${OBJ_DIR}/$(LIB_SO) $+ $(LDFLAGS)
-
-${OBJ_DIR}/%.o: %.cpp
- $(CXX) -fPIC -c $< -o $@ $(CFLAGS) -Wno-unused-variable
-
--include $(OBJECTS:%=$OBJ_DIR/.%.d)
+all: compile flash
+
+# To run Particle, we need to install Particle CLI
+# Please see:
+# https://docs.particle.io/guide/getting-started/connect/photon/#install-the-particle-cli
+monitor:
+ sudo chmod 666 /dev/ttyACM0
+ particle serial monitor
+
+compile:
+ rm -f *.bin
+ particle compile photon
+
+flash:
+ particle flash Photon photon_firmware*.bin
PHONY += clean
clean:
- rm -f *.o *.so
- rm -rf $(OBJ_DIR)
+ rm -f *.bin
PHONY += mrclean
mrclean: clean
rm -rf ../docs
-PHONY += tags
-tags:
- ctags -R
-
tabbing:
uncrustify -c C.cfg --no-backup *.cpp
uncrustify -c C.cfg --no-backup *.h