initial commit
This commit is contained in:
commit
a8ded86fe1
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
bin/
|
||||
obj/
|
41
Makefile
Normal file
41
Makefile
Normal file
@ -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
|
8
src/main.c
Normal file
8
src/main.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("echo Content-type: text/plain\n\nHello World\n");
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user