commit a8ded86fe10f7054b63ea9117ef7ebe70aa9fe74 Author: Thomas Klaehn Date: Sat Jun 29 11:29:51 2019 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd42ee3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e5d4785 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +CROSS_COMPILE ?= +#arm-linux-gnueabihf- + +TARGET_FILE ?= dnssd + +CC = $(CROSS_COMPILE)gcc + +SRC_DIR = src +OBJ_DIR = obj +BIN_DIR = bin + +C_SRCS = $(wildcard $(SRC_DIR)/*.c) +C_OBJS = $(patsubst %.c,$(OBJ_DIR)/%.o,$(notdir $(C_SRCS))) + +OBJS = $(C_OBJS) + +TARGET = $(BIN_DIR)/$(TARGET_FILE) + +.PHONY: all +all: $(TARGET) + +$(TARGET): $(OBJS) + @mkdir -p $(BIN_DIR) + $(CC) $(LD_FLAGS) $(OBJS) $(LIBS) -o $@ + +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c + @mkdir -p $(OBJ_DIR) + $(call makedep,$<,$@,$(patsubst %c,%d,$(OBJ_DIR)/$(notdir $<))) + $(CC) -c $(C_FLAGS) $< -o $@ + +.PHONY: clean +clean: + rm -rf $(OBJ_DIR) $(BIN_DIR) + +define makedep + $(CC) -MM -MF $3 -MP -MT $2 $4 $1 +endef + +ifneq ($(MAKECMDGOALS),clean) +-include $($(subst .o,.d,$(OBJS))) +endif \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..8c09cd9 --- /dev/null +++ b/src/main.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("echo Content-type: text/plain\n\nHello World\n"); + + return 0; +}