mirror of
https://github.com/hufrea/byedpi.git
synced 2024-12-18 03:42:06 +03:00
Fix building .o files in Makefile (#229)
* Revert "Dont use object files"
This reverts commit e9bf029077
.
* recompile all objects on any headers change
This commit is contained in:
parent
e9bf029077
commit
9d9c370d66
1 changed files with 16 additions and 5 deletions
21
Makefile
21
Makefile
|
@ -1,24 +1,35 @@
|
||||||
|
|
||||||
TARGET = ciadpi
|
TARGET = ciadpi
|
||||||
|
|
||||||
CPPFLAGS = -D_DEFAULT_SOURCE
|
CPPFLAGS = -D_DEFAULT_SOURCE
|
||||||
CFLAGS += -I. -std=c99 -Wall -Wno-unused -O2
|
CFLAGS += -I. -std=c99 -Wall -Wno-unused -O2
|
||||||
WIN_LDFLAGS = -lws2_32 -lmswsock
|
WIN_LDFLAGS = -lws2_32 -lmswsock
|
||||||
|
|
||||||
|
HEADERS = conev.h desync.h error.h extend.h kavl.h mpool.h packets.h params.h proxy.h win_service.h
|
||||||
SRC = packets.c main.c conev.c proxy.c desync.c mpool.c extend.c
|
SRC = packets.c main.c conev.c proxy.c desync.c mpool.c extend.c
|
||||||
WIN_SRC = win_service.c
|
WIN_SRC = win_service.c
|
||||||
|
|
||||||
|
OBJ = $(SRC:.c=.o)
|
||||||
|
WIN_OBJ = $(WIN_SRC:.c=.o)
|
||||||
|
|
||||||
PREFIX := /usr/local
|
PREFIX := /usr/local
|
||||||
INSTALL_DIR := $(DESTDIR)$(PREFIX)/bin/
|
INSTALL_DIR := $(DESTDIR)$(PREFIX)/bin/
|
||||||
|
|
||||||
all:
|
all: $(TARGET)
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(SRC) -o $(TARGET) $(LDFLAGS)
|
|
||||||
|
|
||||||
windows:
|
$(TARGET): $(OBJ)
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(SRC) $(WIN_SRC) -o $(TARGET).exe $(WIN_LDFLAGS)
|
$(CC) -o $(TARGET) $(OBJ) $(LDFLAGS)
|
||||||
|
|
||||||
|
windows: $(OBJ) $(WIN_OBJ)
|
||||||
|
$(CC) -o $(TARGET).exe $(OBJ) $(WIN_OBJ) $(WIN_LDFLAGS)
|
||||||
|
|
||||||
|
$(OBJ): $(HEADERS)
|
||||||
|
.c.o:
|
||||||
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGET) $(TARGET).exe $(OBJ) $(WIN_OBJ)
|
rm -f $(TARGET) $(TARGET).exe $(OBJ) $(WIN_OBJ)
|
||||||
|
|
||||||
install: all
|
install: $(TARGET)
|
||||||
mkdir -p $(INSTALL_DIR)
|
mkdir -p $(INSTALL_DIR)
|
||||||
install -m 755 $(TARGET) $(INSTALL_DIR)
|
install -m 755 $(TARGET) $(INSTALL_DIR)
|
||||||
|
|
Loading…
Reference in a new issue