Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. MODULE_NAME := nswasabi
  2. CPPSOURCES := ComponentManagerBase.cpp ApplicationBase.cpp ID3v2Metadata.cpp ID3v1Metadata.cpp PlaybackBase.cpp APEv2Metadata.cpp
  3. #CSOURCES := utf.c ByteReader.c ByteWriter.c
  4. LIBRARY_FILENAME := lib$(MODULE_NAME).a
  5. OUTPUT_PATH := ../build/$(MODULE_NAME)
  6. ARCHIVE_PATH := ../build/lib
  7. LIBRARY_FILEPATH := ../build/lib/$(LIBRARY_FILENAME)
  8. CPPOBJS := $(patsubst %.cpp,$(OUTPUT_PATH)/%.o,$(CPPSOURCES))
  9. CPPDEPS := $(patsubst %.o,$(OUTPUT_PATH)/%.d,$(CPPOBJS))
  10. COBJS := $(patsubst %.c,$(OUTPUT_PATH)/%.o,$(CSOURCES))
  11. CDEPS := $(patsubst %.o,$(OUTPUT_PATH)/%.d,$(COBJS))
  12. OBJS := $(CPPOBJS) $(COBJS)
  13. DEPS := $(CPPDEPS) $(CDEPS)
  14. CFLAGS=-I.. -fPIC #-fvisibility=hidden
  15. CPPFLAGS := ${CFLAGS}
  16. build: build-dir $(LIBRARY_FILEPATH)
  17. build-dir:
  18. @mkdir -p $(OUTPUT_PATH)/linux > /dev/null 2> /dev/null
  19. @mkdir -p $(OUTPUT_PATH) > /dev/null 2> /dev/null
  20. @mkdir -p $(ARCHIVE_PATH) > /dev/null 2> /dev/null
  21. dep:
  22. @rm ${DEPS}
  23. $(OUTPUT_PATH)/%.o: %.cpp
  24. #@echo Compiling $*.cpp
  25. @$(CXX) $(CPPFLAGS) -MMD -MF $(OUTPUT_PATH)/$*.d -MT $(OUTPUT_PATH)/$*.o -c $*.cpp -o $(OUTPUT_PATH)/$*.o
  26. $(OUTPUT_PATH)/%.o: %.c
  27. #@echo Compiling $*.c
  28. @$(CC) $(CFLAGS) -MMD -MF $(OUTPUT_PATH)/$*.d -MT $(OUTPUT_PATH)/$*.o -c $*.c -o $(OUTPUT_PATH)/$*.o
  29. $(LIBRARY_FILEPATH): ${OBJS}
  30. @$(AR) rcs $@ ${OBJS}
  31. clean:
  32. -rm -f ${OBJS} $(LIBRARY_FILENAME) ${DEPS}
  33. -include $(DEPS)