Commit 50a950fd authored by Joanne Hugé's avatar Joanne Hugé

Move client and server files into a single folder

parent 7bd835d9
ARM_CC = arm-linux-gnueabihf-gcc
SERVER_ARM_PROG = server_arm
CLIENT_ARM_PROG = client_arm
SERVER_PROG = server
CLIENT_PROG = client
SRCDIR = ../src
SERVER_SRCS = server.c
CLIENT_SRCS = client.c
CLIENT_SRCS += send_packet.c
SERVER_OBJS = $(SERVER_SRCS:%.c=%.o)
CLIENT_OBJS = $(CLIENT_SRCS:%.c=%.o)
CFLAGS = -Og -g -Wall -Werror -Wextra
CFLAGS += -MD -MP
CFLAGS += -I $(SRCDIR)
CFLAGS += -std=gnu99
LDFLAGS = -pthread
vpath %.c $(SRCDIR)
$(SERVER_ARM_PROG): FORCE
make clean
make -e CC:=$(ARM_CC) $(SERVER_PROG)
mv $(SERVER_PROG) $(SERVER_ARM_PROG)
$(CLIENT_ARM_PROG): FORCE
make clean
make -e CC:=$(ARM_CC) $(CLIENT_PROG)
mv $(CLIENT_PROG) $(CLIENT_ARM_PROG)
FORCE:
$(SERVER_PROG): $(SERVER_OBJS)
$(CC) $(LDFLAGS) $^ -o $@
$(CLIENT_PROG): $(CLIENT_OBJS)
$(CC) $(LDFLAGS) $^ -o $@
-include $(subst .c,.d,$(SERVER_SRCS))
-include $(subst .c,.d,$(CLIENT_SRCS))
clean:
$(RM) $(SERVER_OBJS) $(SERVER_PROG) $(SERVER_ARM_PROG) $(subst .c,.d,$(SERVER_SRCS))
$(RM) $(CLIENT_OBJS) $(CLIENT_PROG) $(CLIENT_ARM_PROG) $(subst .c,.d,$(CLIENT_SRCS))
.PHONY: clean FORCE
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "getip.h"
#include "send_packet.h" #include "send_packet.h"
#define CLOCK_ID CLOCK_MONOTONIC #define CLOCK_ID CLOCK_MONOTONIC
......
ARM_CC = arm-linux-gnueabihf-gcc
ARM_PROG = main_arm
PROG = main
SRCDIR = ../src
SRCS = main.c
SRCS += getip.c
SRCS += send_packet.c
OBJS = $(SRCS:%.c=%.o)
CFLAGS = -Og -g -Wall -Werror -Wextra
CFLAGS += -MD -MP
CFLAGS += -I $(SRCDIR)
CFLAGS += -std=gnu99
LDFLAGS = -pthread
vpath %.c $(SRCDIR)
$(ARM_PROG): FORCE
make clean
make -e CC:=arm-linux-gnueabihf-gcc $(PROG)
mv $(PROG) $(ARM_PROG)
FORCE:
$(PROG): $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@
-include $(subst .c,.d,$(SRCS))
run: $(PROG)
./$^
clean:
$(RM) $(OBJS) $(PROG) $(subst .c,.d,$(SRCS))
.PHONY: clean FORCE
ARM_CC = arm-linux-gnueabihf-gcc
ARM_PROG = main_arm
PROG = main
SRCDIR = ../src
SRCS = main.c
OBJS = $(SRCS:%.c=%.o)
CFLAGS = -O1 -g -Wall -Werror -Wextra
CFLAGS += -MD -MP
CFLAGS += -I $(SRCDIR)
CFLAGS += -std=gnu99
vpath %.c $(SRCDIR)
$(ARM_PROG): FORCE
make clean
make -e CC:=arm-linux-gnueabihf-gcc $(PROG)
mv $(PROG) $(ARM_PROG)
FORCE:
$(PROG): $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@
-include $(subst .c,.d,$(SRCS))
run: $(PROG)
./$^
clean:
$(RM) $(OBJS) $(PROG) $(subst .c,.d,$(SRCS))
.PHONY: clean FORCE
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment