Makefile 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. MODULE_NAME := Wasabi
  2. CPPSOURCES := api.cpp ServiceManager.cpp SysCallbacks.cpp
  3. LIBRARY_FILENAME := lib$(MODULE_NAME).a
  4. OUTPUT_PATH := ../build/$(MODULE_NAME)
  5. ARCHIVE_PATH := ../build/lib
  6. LIBRARY_FILEPATH := ../build/lib/$(LIBRARY_FILENAME)
  7. CPPOBJS := $(patsubst %.cpp,$(OUTPUT_PATH)/%.o,$(CPPSOURCES))
  8. CPPDEPS := $(patsubst %.o,$(OUTPUT_PATH)/%.d,$(CPPOBJS))
  9. COBJS := $(patsubst %.c,$(OUTPUT_PATH)/%.o,$(CSOURCES))
  10. CDEPS := $(patsubst %.o,$(OUTPUT_PATH)/%.d,$(COBJS))
  11. OBJS := $(CPPOBJS) $(COBJS)
  12. DEPS := $(CPPDEPS) $(CDEPS)
  13. CFLAGS=-I..
  14. CPPFLAGS := ${CFLAGS}
  15. build: build-dir $(LIBRARY_FILEPATH)
  16. build-dir:
  17. @mkdir -p $(OUTPUT_PATH) > /dev/null 2> /dev/null
  18. @mkdir -p $(ARCHIVE_PATH) > /dev/null 2> /dev/null
  19. dep:
  20. @rm ${DEPS}
  21. $(OUTPUT_PATH)/%.o: %.cpp
  22. #@echo Compiling $*.cpp
  23. @$(CXX) $(CPPFLAGS) -MMD -MF $(OUTPUT_PATH)/$*.d -MT $(OUTPUT_PATH)/$*.o -c $*.cpp -o $(OUTPUT_PATH)/$*.o
  24. $(LIBRARY_FILEPATH): ${OBJS}
  25. $(AR) rcs $@ ${OBJS}
  26. clean:
  27. -rm -f ${OBJS} $(LIBRARY_FILENAME) ${DEPS}
  28. -include $(DEPS)